3

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
  • 30,233
  • 76
  • 247
  • 468

1 Answers1

7

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
  • 441,113
  • 110
  • 1,021
  • 1,148