Selenium xpath selector based on the element text

0
0

What would a selenium xpath selector be for the following html:

<ul>
<li>First</li>
<li>Second</li>
<li>Third</li>
</ul>

I need to make Selenium IDE locate the second item on the list based on the element text. I thought //li='Second' would do the trick, but apparently it does not

  • You must to post comments
0
0

I think this is what you are looking for

ul/li[contains(text(), "Second")]

and better still

ul/li[text() = 'Second']
  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website