繁体   English   中英

重定向后出错 - “无法确定加载状态”

[英]Error after redirection - "cannot determine loading status"

我需要一些有关 Selenium/PyCharm 的帮助。 切换到新 PC 后,在搜索按钮并单击它时,以前可以正常工作的代码开始出现问题。 有趣的事情:问题只出现在这个按钮上,我什至会说重定向。 如果你跳过这一步,一切都会完美无缺。

driver.find_element(By.ID, "phone").send_keys("0991041337")
driver.find_element(By.NAME, "password").send_keys("Login123")
button_login = driver.find_element(By.ID, "submit-login").click()
time.sleep(1)

错误的屏幕截图在这里

如果有人可以帮助我,我将不胜感激:)

有一个相对较新的 Selenium 错误,即使单击成功,也会出现cannot determine loading status 这将解决您的问题:

driver.find_element(By.ID, "phone").send_keys("0991041337")
driver.find_element(By.NAME, "password").input2_pw.send_keys("Login123")
button_login = driver.find_element(By.ID, "submit-login")

from selenium.common.exceptions import WebDriverException

try:
    button_login.click()
except WebDriverException as e:
    if "cannot determine loading status" in e.msg:
        pass  # Odd issue where the click did happen. Continue.
    else:
        raise e

我是SeleniumBase的维护者,所以我直接在https://github.com/seleniumbase/SeleniumBase/issues/1374中修复了这个问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM