identify same button in different locations

Best practices, code snippets for common functionality, examples, and guidelines.
skyphoenix
Posts: 3
Joined: Tue Oct 11, 2016 5:35 pm

identify same button in different locations

Post by skyphoenix » Tue Oct 11, 2016 9:06 pm

Hi!
We are testing a web application which uses i.e. a back button. The back button is used on different web bpages of the application and so I have several Xpath for this object.

Currently I would like to combine those two path or use them with an XOR operator in the Xpath if possible. Or do I really have to treat them as several repository items?
I tried to experimented weith the xpath but unfortunately, no luck.
Can this be solved with one Xpath?

one is here:
.//form[#'technical_element_form']/div//tag[@tagname='as-toolbar-block']/div/tag[2]/span/button[@innertext='Back']

the other here:
.//form[#'technical_element_form']/div/?/?/span/?/?/div/tag[2]/span/span[1]/button[@innertext='Back']

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

Re: identify same button in different locations

Post by odklizec » Wed Oct 12, 2016 9:35 am

Hi,

Have you tried something like this:

Code: Select all

.//form[#'technical_element_form']/div//span/button[@innertext='Back']
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