HTML
<div data-testid="signin-back-button" class="white-arrow">
<a href="/" class="back-text" onclick="backBtnClick()">
<img class="back-arrow-white" src="/images/arrow-left-white.svg" aria-hidden="true">
Back
</a>
</div>
I have written xpath as
//a[@onclick='backBtnClick()']/img[contains(text(),'Back')]
CodePudding user response:
There is not need to rely on text, please use below xpath
//a[@onclick='backBtnClick()']//child::img[contains(@src,'images/arrow-left-white.svg')]
CodePudding user response:
use double slash in your xpath
//a[@onclick='backBtnClick()']//img[contains(text(),'Back')]