I want to get text included in a span tag.
Here's HTML
<div class="position">
<h1>
<span class="select-text">Some Text</span>
</h1>
</div>
And I've tried this
wd.findElement(By.xpath("//div[@class="position"]//h1//span")).getText();
But I get this error all the time and IDK what I'm doing wrong
org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//div[@class="position"]//h1//span"}
Additional problem: after getting a text from this page I need to make sure if this text is not visible on another page. If you have any idea how can I realize it I'll be grateful.