0

我正在selenium使用 python 在raspberry pi. 我已经安装了iceweaselFirefox 的版本。我正在按照此视频的说明进行操作。

我有一个使用 selenium 打开的网站,我试图点击一个链接,该链接将在网站上打开一个页面。通常如果我这样做(没有硒),它工作正常。但是使用 selenium,打开时间太长,并且网站上的加载图标一直显示。由于以下警告消息出现在浏览器中,python selenium 代码无法处理并崩溃。

在此处输入图像描述

下面是代码:

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 正在点击仪表板页面。一旦这件事发生,我也可以在网站上看到它被点击。但在此之后,它继续加载和加载,然后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)

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

如何从 python selenium 处理网页的这种行为。请帮忙。谢谢

4

0 回答 0