【发布时间】:2018-06-13 17:58:20
【问题描述】:
使用 python、chromedriver 和 Windows。
我已经编写了几个月的脚本,它定期使用 .click() 函数,几天前它停止在网站上的任何地方工作。我一直在尝试通过 id、xpath 等来定位元素……或者甚至通过send_keys(Keys.ENTER) 单击它,但没有成功。我只是想点击登录图标,但没有任何反应。似乎找到了元素并单击它,但没有任何反应。这是the site,这里是代码:
browser = webdriver.Chrome(chrome_options=options, executable_path=r'chromedriver.exe')
browser.get(('https://es.wallapop.com/'))
signInButton = WebDriverWait(browser, 5).until(EC.element_to_be_clickable((By.ID, 'js-show-login-modal')))
signInButton.click()
signInButton = WebDriverWait(browser, 5).until(EC.element_to_be_clickable((By.ID, 'btn-go-login-form')))
signInButton.click()
不工作的一部分是我从终端得到的:
Traceback (most recent call last):
File "wallapop_delete.py", line 55, in <module>
signInButton = WebDriverWait(browser, 5).until(EC.element_to_be_clickable((B
y.ID, 'btn-go-login-form')))
File "C:\Users\zaico\AppData\Local\Programs\Python\Python36\lib\site-packages\
selenium\webdriver\support\wait.py", line 80, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
这就是浏览器应该发生的事情:
【问题讨论】:
-
您检查过(浏览器)错误吗?
-
你的 chrome 和 chrome 驱动版本是什么
-
@Zaico- 没听懂,请加上chrome浏览器和chrome驱动的版本号
-
@Zaico 是的,我已经看到了这些屏幕,因为您的代码与我的旧 chromedriver(2.36?)一起使用了 try/except。我刚刚将我的 chromedriver 升级到最新版本(2.40?),您的代码无需任何修改即可运行。您是否尝试过升级您的 chromedriver?
-
@Zaico - 请将您的 chromedriver 更新到 2.40
标签: python google-chrome selenium selenium-webdriver selenium-chromedriver