I'm attempting to scrape the text 64076 next to Item model number: on this page using the following XPath expression:
//*[contains (@id,'productDetails')]//tr[contains(.,'Item model number')]/td|//*[contains (@id,'detail')]//descendant::li[contains(.,'Item model number')]/text() // I'm focusing mainly on second half of expression..
However, although this matches the expected text (64076) in Firebug it is not found when using Selenium WebDriver (Java).
When I change the XPath to:
//*[contains (@id,'productDetails')]//tr[contains(.,'Item model number')]/td|//*[contains (@id,'detail')]//descendant::li[contains(.,'Item model number')]
It works however it also scrapes the text Item model number: which I do not want (I know I could parse the result using regex but I'm trying to understand why my XPath is not working since I am clearly matching the actual text/number via text()
, not the bold text)
Thanks