Python Selenium Firefox - 不安全的连接错误警报

时间:2016-03-10 12:50:29

标签: python selenium selenium-webdriver

我正在使用Python Selenium和FireFox,我正在努力解决问题。偶尔在测试脚本中,我遇到一个从https提交到http的表单,它会抛出此错误......

The information you have entered on this page will be sent over an insecure connection and could be read by a third party

我已经看过使用 driver.switchTo()。alert()。accept(); 但是它不起作用,我认为是因为它生成了FireFox警告而不是网站上的java?我收到的错误是......

AttributeError: 'WebDriver' object has no attribute 'switchTo'

任何人都有解决这个问题的经验吗?

1 个答案:

答案 0 :(得分:2)

在Python中,它是switch_to。替换:

driver.switchTo().alert().accept();

使用:

driver.switch_to.alert.accept()

虽然,我不确定这是一个常规警报,你可以切换到这种方式。我怀疑是否显示警告的行为是通过特定的firefox偏好控制的。

相关问题