4

enter image description here

I have some html that looks like the screenshot. I want to get the table rows. I have:

for table_row in response.selector.xpath("//*[@id = 'ctl00_ContentPlaceHolder1_CaseDetailParties1_gvParties']"):
    print table_row

In the command line I tried:

>>> table_row
Out[5]: <Selector xpath="//*[@id = 'ctl00_ContentPlaceHolder1_CaseDetailParties1_gvParties']" data=u'<table class="ParamText" cellspacing="0"'>
>>> table_row.xpath('/tbody')
Out[6]: []
>>> table_row.xpath('//tbody')
Out[7]: []

Why am I unable to select the tbody?

user1592380
  • 34,265
  • 92
  • 284
  • 515

1 Answers1

8

tbody is generated by the browser, you don't get it with Scrapy downloader. Just get straight to the tr elements:

table_row.xpath('.//tr')
Community
  • 1
  • 1
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195