Page 1 of 1

Can not simplfy xpath of a div tag

Posted: Thu Oct 01, 2020 7:07 pm
by rastek
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']

Re: Can not simplyf xpath of a divtag

Posted: Thu Oct 01, 2020 8:34 pm
by odklizec
Hi,

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

Re: Can not simplyf xpath of a divtag

Posted: Thu Oct 01, 2020 9:33 pm
by rastek
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

Re: Can not simplfy xpath of a div tag

Posted: Fri Oct 02, 2020 6:27 am
by odklizec
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.