【发布时间】:2020-01-22 21:09:38
【问题描述】:
我正在尝试使用selenium 从div 元素中选择一个table 值,
当我检查元素时,我可以看到该元素包含 table,但在查看源代码时找不到它(这在尝试通过 selenium 访问时发生)。
检查期间:
下面是我试过的代码,
totals = driver.find_element_by_id("totals")#gets the totals div element. Only one is there
labels=totals.find_elements_by_class_name("hasLabel")#should get the table rows, but it was empty
print(len(labels))#returned 0
但是,它是空的(正如我在源代码中看到的)。作为自动化的一部分,我需要将这些值导出到文件中
还有其他方法可以提取这些应有的价值吗?
【问题讨论】:
标签: python-3.x selenium selenium-chromedriver