I have HTML which looks basically like the following:
...
<a class="btnX btnSelectedBG" href="#"><span>Sign in</span></a>
...
The following xpath in Selenium fails to find an element:
//a[contains(text(), 'Sign in') and contains(@class,'btnX')]
The following xpaths in Selenium succeed, but are not specific enough for me.
//a[contains(text(), 'Sign in')]
//a[contains(@class, 'btnX')]
Why is the xpath failing to find an element, and what can I do to get it to work?
//a[contains(text(), 'Sign in')]
shouldn't select that element – Illustrative