I would like to get a text that exactly comes after a specific element. Please look at the sample code:
<div id="content-tab-submitter" class="">
<h4>Sender</h4>
<p>
<span class="screenHidden">Name: </span>
submitter
<br>
<span class="screenHidden">E-mail address:</span>
submitter@asd.com
<br>
<span class="screenHidden">Account: </span>
asdas
<br>
</p>
</div>
I would like to get the text that comes exactly after <span>
which contains "Account".
By using this XPath expression:
//*[@id='content-tab-submitter']/p/span[contains(text(),'Account')]/following::text()
Java gives me an error, since the output is not a web element and it is a text. So, it is not possible to use findElement.
How can I get this text in a clean way? I mean I do not want to get all texts (in this case): submitter\nsubmitter@asd.com\nasdas and then extract the desired text.