I’m new to both XPath and Selenium. I have a need to be able to click a link with Selenium based on whether or not a span is as a certain text. The example code is:
<div>
<span>Fri</span>
<ul>
<li>
<a href=#></a>
</li>
</ul>
</div>
<div>
<span>Sat</span>
<ul>
<li>
<a href=#></a>
</li>
</ul>
</div>
My XPath expression is //*[text()[contains(.,'Fri')]] which finds the correct span. Now I thought I could use //*[text()[contains(.,'Fri')]]../ul/li/a, but that doesn't work.
How can I do it?