Can not simplfy xpath of a div tag

Ask general questions here.
rastek
Posts: 176
Joined: Wed Aug 06, 2014 12:00 pm

Can not simplfy xpath of a div tag

Post by rastek » Thu Oct 01, 2020 7:07 pm

Hi,

I have a web login page where I want to simply XPath of a div tag (fullpath works but I want to simplfy)


.//div[#'root']/div/div/div[2]/div/div/div/div[4]/div[@innertext='Use another account']

I really wonder why these doesnt work , can someone provide me a solution ?

this is no work
.//div[@innertext='Use another account']

also tried this
.//div[#'root']//div[@innertext='Use another account']
Last edited by rastek on Thu Oct 01, 2020 10:25 pm, edited 3 times in total.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6360
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Can not simplyf xpath of a divtag

Post by odklizec » Thu Oct 01, 2020 8:34 pm

Hi,

Please post a Ranorex snapshot (NOT screenshot) of the problematic element. It would be much easier to provide a reasonable answer with snapshot.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

rastek
Posts: 176
Joined: Wed Aug 06, 2014 12:00 pm

Re: Can not simplyf xpath of a divtag

Post by rastek » Thu Oct 01, 2020 9:33 pm

I need to use spy in order to get a snapshot however spy does not recognise inside main screen of the browser

only gets item into repo when I track from repo and that has no snaphot option


Please tell me if there is another way to get snapshot


Its interesting that when I highligt in repository it highlits the div, but it does not find during test run.

Is there a speacial issue for divs ? Can you just write me simpflied versiont of that long Xpath ?


btw, div can be found at this side

giris.hepsiburada.com

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6360
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Can not simplfy xpath of a div tag

Post by odklizec » Fri Oct 02, 2020 6:27 am

Hi,

I'm afraid, I'm unable to reach the page you posted. It says "The connection has timed out". So I guess this page is only available from your internal network? Anyway, you can create the snapshot also from recording. Simply drag and drop the repo element representing the xpath in question (or better entire DOM) to recording of your choice and from the appeared menu select "Create snapshot" option. Then simply run the recording (or entire test suite) and the snapshot should be created directly in rxzlog. Then please share the rxzlog. Thanks.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration