i am using Selenium and i would like to replace xpath to get a list of this
So far this xpath works, but i think is is unsophisticated. I think is better change for a CSSselector or shorter xpath, but i am not able to gat the same result.
Thanks
i am using Selenium and i would like to replace xpath to get a list of this
So far this xpath works, but i think is is unsophisticated. I think is better change for a CSSselector or shorter xpath, but i am not able to gat the same result.
Thanks
Below xpath will work
"//div[@id='igTreeProjectTree']//li[starts-with(@data-path, '0_0_')]"
Because I think data-path is unique in all elements
For the xpath:
//*[@id='igTreeProjectTree']/ul/li/ul/li/ul/li
The equivalent css-selectors will be:
#igTreeProjectTree > ul > li > ul > li > ul > li
A more canonical Locator Strategy would be:
#igTreeProjectTree ul[data-depth='2'] > li.ui-igtree-node-nochildren[data-path='0_0_0']