I use Selenium with Firefox Webdriver to work with elements on the page with unique CSS IDs (each time the page loads), but the IDs change every time, so I can not use them to find the element. This is because the page is a web application built using ExtJS.
I am trying to use Firebug to get item information.
I need to find a unique xPath or selector so that I can select each element separately with Selenium.
When I use Firebug to copy xPath, I get this value:
//*[@id="ext-gen1302"]
However, the next time the page loads, it looks like this:
//*[@id="ext-gen1595"]
On this page, each element has this identifier format, so the CSS identifier cannot be used to find the element.
I want to get xPath in terms of its position in the DOM, but Firebug will return the xPath identifier, since it is unique to this page instance.
/html/body/div[4]/div[3]/div[4]/div/div/div/span[2]/span
How can I get Firebug (or another tool that will work at the same speed) to give me a unique selector that can be used to search for an element with Selenium even after changing the ext-gen identifier?
source share