0

Given the following object:

<span id="PartComment">
REMAN WATER PUMP
<i>w/2.05" DIAMETER THERMOSTAT OUTLET - SUPPLIED w/PULLEY
</i>
</span>

I'm trying to come up with an xpath that should locate me only the span by id and the text inside it (REMAN WATER PUMP). Unfortunately, the text inside the i is also caught up.

I was thinking of something like:

//span[@id='PartComment'][not(self::i)]

But it keeps selecting the i text too.

Thanks for stopping by!

zuri
  • 73
  • 1
  • 9

1 Answers1

2

Try this:

//span[@id='PartComment']/text()
OldProgrammer
  • 12,050
  • 4
  • 24
  • 45