I know that WebDriver can locate links through their text, using
Is it possible to locate any element (such as
span, ...) by text?
Yes. WebDriver supports using an XPath to locate an element by the text it contains. For example, the following XPath locates any div containing the string "Hello Justin":
As User246 mentioned, the xpath support depends on the browser. I have found a few problems with using XPath cross-browser. My solution for this problem was to find elements by tag name first, then iterate through the list of elements matching the tag and look for the attributes that I want to match on as well.
Hi can anyone please plz help me how to use contains in my xpath, my xpath changes all the time when users are added so i cant find element using xpath,,,
this is my xpath: .//*[@id='contentText']/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr/td/strong
changes when new user added: .//*[@id='contentText']/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr/td/strong.,., plz help me how to get it done.,.,