Wednesday, 12 December 2012

Selenium xpath - issue locating WebElement using contains(text(), 'somevalue')

I've recently encountered an issue where my xpath should be easily expressed as
xpath=//div[contains(text(), accountId)]
but this did not work. I thought I'd share the problem here.

I am trying to identify


What does work 


will return the object.

Conclusion

So it appears that text() within xpath identification will only get text up until the start of the next tag.. which is limiting.

I am not sure of a workaround yet, but will post one as soon as I've answered it.


No comments:

Post a Comment

Robot Framework, Basic Setup

Plug: Robot Framework is quick to setup, easy to write tests for, and super fast to triage failures in. The last point really sets it apart...