Reputation: 9
I am trying to select the "(6)" in the tag below:
<a class="itemRating" href="http://www.newegg.com/Product/ProductReview.aspx?Item=N82E16834200347" title="Rating + 4">
<span class="eggs r4"> </span>
(6)
</a>
The xpath, which I will call review, is in the () below:
review = site.xpath('/html/body/div[3]/div[2]/table/tr/td[2]/div/div[8]/div/div/div/a[3]
When I try printing review[0]
.text, it prints 'None'
instead of the (6)
.
Any ideas?
Upvotes: 0
Views: 279
Reputation: 9512
You can use:
review[0].text_content().strip()
or
review[0].xpath('string()').strip()
And I'd write your xpath as:
review = site.xpath('//a[@class="itemRating"]')
Upvotes: 0