I am trying to find cases using Xpath/Selenium where there is no white-space before the hyperlink.
e.g.
<p>Click on this<a href="#">link</a>to access the data</p>`
This renders as Click on thislinkto access the data
Problem : Locate all the <a>
elements and test if they have white-space before and after
Is there any elegant way to get the text before/after of anchor? I am thinking of using XPath query such as //a/parent::*
which returns <p>
element but the <a>
tag is not separated. Can I somehow get the immediate text before/after the anchor tag?