<span class='python'>
<a>google</a>
<a>chrome</a>
</span>
I want to get chrome
and have it working like this already.
q = item.findall('.//span[@class="python"]//a')
t = q[1].text # first element = 0
I'd like to combine it into a single XPath expression and just get one item instead of a list.
I tried this but it doesn't work.
t = item.findtext('.//span[@class="python"]//a[2]') # first element = 1
And the actual, not simplified, HTML is like this.
<span class='python'>
<span>
<span>
<img></img>
<a>google</a>
</span>
<a>chrome</a>
</span>
</span>