代码之家  ›  专栏  ›  技术社区  ›  S Andrew

如何使用selenium python删除Firefox中的无响应脚本

  •  0
  • S Andrew  · 技术社区  · 6 年前

    selenium 打开python raspberry pi . 我已经安装了 iceweasel Firefox版本。我是按照这个指示来做的 video .

    enter image description here

    代码如下:

    DASHBOARD = (By.XPATH, data["Dashboard"])  # data["Dashboard"] is getting XPATH from config file
    
    WebDriverWait(driver, 20).until(EC.element_to_be_clickable(DASHBOARD)).click()
    print("Dashboard page clicked {}")
    time.sleep(20)
    

    在上面的python代码中,selenium正在单击dashboard页面。一旦这件事发生,我也能看到它在网站上被点击。但在这之后,它继续装载,装载,然后 Unresponsive script 出现警告并显示以下错误:

    Script: https://<url>/asse…/angular/angular.js?20190904.1:9336) The alert could not be closed. The browser may be in a wildly inconsistent state, and the alert may still be open. This is not good. If you can reliably reproduce this, please report a new issue at https://github.com/SeleniumHQ/selenium/issues with reproduction steps. Exception message: TypeError: a.document.getElementsByTagName(...)[0].getButton is not a function

    我试过用 driver.implicitly_wait(5)

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable(DASHBOARD)).click()
    print("Dashboard page clicked {}")
    time.sleep(20)
    driver.implicitly_wait(5)
    

    它删除了警告,但浏览器上没有发生什么事情。页面仍在加载,没有显示任何内容。

    我如何处理pythonselenium的web页面的这种行为呢。请帮忙。谢谢

    0 回复  |  直到 6 年前