如何使用裂片在表格中查找网格?

时间:2019-02-18 08:35:33

标签: python dom web-scraping splinter

我想在表格中找到这样的元素: enter image description here

我尝试了

b.find_by_id('resourceTd_5897')

b.find_by_css('td#resourceTd_5897.resourceTd')

甚至

b.find_by_tag('td')

它们都引发no elements could be found with......异常。

如何在表格中找到网格?

1 个答案:

答案 0 :(得分:0)

等待一会儿页面完全加载怎么办?

from splinter import Browser
b = Browser("chrome")
b.visit("https://splinter.readthedocs.io/en/latest/tutorial.html")

if b.is_element_present_by_xpath("//div[@id='create-a-browser-instance']/h2", wait_time=5):
    # wait until the element's appearing
    print(b.find_by_xpath("//div[@id='create-a-browser-instance']/h2"))

有关splinter documents的更多信息

希望它对您有所帮助..