【发布时间】:2021-09-24 12:45:01
【问题描述】:
上面是页面的链接
:https://i.stack.imgur.com/8bhzV.png
红色标记的框号是我试图通过 xpath 得到的
:https://i.stack.imgur.com/mca05.png
红色标记的框是同一项目的检查行。我的代码在下面
**scrapy shell**
**fetch("http://mnregaweb4.nic.in/netnrega/asset_report_dtl.aspx?lflag=eng&state_name=WEST%20BENGAL&state_code=32&district_name=NADIA&district_code=3201&block_name=KRISHNAGAR-I&block_code=&panchayat_name=DOGACHI&panchayat_code=3201009009&fin_year=2020-2021&source=national&Digest=8+kWKUdwzDQA1IJ5qhD8Fw")**
**assetid = response.xpath("//div[3]/center/table[2]/tbody/tr[4]/td[2]")**
**assetid**
**[]**(This is what it returns.)
**assetid = response.xpath("//div[3]/center/table[2]/tbody/tr[4]/td[2]/text()")**(I tried this also)
**assetid**
**[]**(This is what it returns.)
当使用视图(响应)时,它显示为 true 并在浏览器中打开同一页面。
我的代码在下面
【问题讨论】: