BeautifulSoup找不到具体的表格

时间:2015-02-10 19:31:20

标签: python beautifulsoup python-requests

我的目标是解析网页上有5个可能客户的网页,并从每个CustomerTable获取他们的名字。由于每个客户有1个CustomerTable,我的想法是首先从汤中获取表格,然后解析表格的内容以获得客户的名字。

我使用Python的请求包获取网页的html。在解析响应的纯文本时,我可以找到具有class =“CustomerTable”属性的表。但是,当我做的时候

response = session.get(customersPage)
soup = BeautifulSoup(response.text)
for table in soup.find_all('table'):
  print(table.get('class'))

找不到具有CustomerTable作为类名的表。实际上,在response.text中的52个表中,此片段仅打印“无”4次。有没有更好的方法来实现我的总体目标?导致此页面中的表格无法找到的原因是什么? CustomerTables本来是由javascript生成的,所以这可能导致在汤中找不到表吗?

抱歉,我无法发布网页的全部内容,但我可以尝试尽可能多地提供上下文。内容通过付费服务并由我公司购买。

0 个答案:

没有答案
相关问题