user2129794
user2129794

Reputation: 2418

Not able to extract text from the td tag/element using python scrapy

I want to extract the text from the site http://www.jabong.com/Puma-Wirko-Ind-Black-Sneakers-187839.html using x-path:

      `item['pcode'] = hxs.select('//*[@id="productInfo"]/div[1]/div[2]/table/tbody/tr[8]/td[2]/text()').extract()`

I'm getting null value.

Upvotes: 1

Views: 538

Answers (1)

thinker3
thinker3

Reputation: 13301

I tried the following, it works. I used urllib2 to fetch the HTML.

text = hxs.select('//div[@id="productInfo"]//table/tr[8]/td[2]/text()').extract()

and the following not works:

text = hxs.select('//div[@id="productInfo"]//table/tbody/tr[8]/td[2]/text()').extract()

Upvotes: 1

Related Questions