Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98807

How to write generic xpath?

$
0
0

I am trying to write generic XPath for the below sites. Both sites have same elements on UI, but DOM structure is different while interacting with elements.

Here I am trying to get the text of left eye and right eye quantity

I am getting a text when I am using below XPath for Norway and UK respectively but when I am trying to write generic XPath which will work on both sites I am facing an issue :

So I wrote below XPath will work on both sites but it's not.

//a[contains(@id,'qty-1')] 

Expected Behaviour:

I want Quantity for both left and right eye element on both sites with the same XPATH.


Viewing all articles
Browse latest Browse all 98807


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>