Selenium 无法调用按钮元素的点击功能

2024-05-12 16:17:15 发布

您现在位置:Python中文网/ 问答频道 /正文

因此,我使用Python访问URLhttps://losangeles.craigslist.org/wst/sub/d/furnished-master-bedroom-with/6721294465.html,并希望单击reply按钮。到目前为止,我已经尝试了以下代码,但没有工作

driver = webdriver.Firefox()
    driver.maximize_window()
    driver.get('https://losangeles.craigslist.org/wst/sub/d/furnished-master-bedroom-with/6721294465.html')
    sleep(10)
    driver.find_element_by_css_selector('.reply-button').click()

我通过FireFox检查发现:

不管怎样,我还是应该像JS文件中所给出的那样调用jqueryclick吗?你知道吗

如果与FF一起工作,我最终会使用PhantomJS。你知道吗

enter image description here

更新

正如用户Infern0建议的那样。它确实会单击,但有些内容不会加载弹出窗口,我看到以下内容:

enter image description here


Tags: 代码orgmasterhtmldriverwithreply按钮