Code on page:
<div class='container'>
<p>
<b>Address:</b> Some address<br />
<b>Phone:</b> phone1, phone2<br />
<b>E-mail: </b><a href='mailto:somemail' >somemail</a><br />
<b>Site:</b><a href='somesite'>somesite</a>
</p>
</div>
I need to select text after </b> and before <br /> using XPATH.
In this case I would need to get ‘Some address’ or ‘phone1, phone2’ etc.
‘Some address’ needs to be in $var1
‘phone1, phone2’ in $var2
I tried with .//*[@class="container"]/p/text()[1] it didn’t worked.
Try this one
This will select the text nodes within the P element tree (of the div with the class attribute “container”) that are not within a B element tree or empty, e.g. this would give you
Demo
Also have a look at this XPath tutorial.