0
votes

having the following XML code:

<div class="content">
<ul>
<li>
<b>Item model number:</b>
   FCC5302Q-2
</li>
</ul>

I used this xpath expression to select the li node text:

//*[contains(@class, "content")]//li[b/text()="item model number"]/text()

And for some reason it fails to pick the text of the li element. Where am I going wrong with this?

2

2 Answers

1
votes
  1. Use single quotes
  2. Match cases
  3. Watch out for the brackets you use..

Try this XPath..

//*[contains(@class, 'content')]//li/b[text()='Item model number:']/text()
0
votes

Make sure you write the <b> element text verbatim, including case.

//*[contains(@class, "content")]//li[b/text()="Item model number:"]/text()