绕过 Microsoft Edge 上的 Selenium Webdriver 安全证书页面
Bypass Security Certificate page on Microsoft Edge for Selenium Webdriver
我正在尝试使用 Python 绕过 Microsoft Edge for Selenium Webdriver 的安全证书页面。
我尝试了适用于我在此 thread 上找到的以前版本的 Internet Explorer 的解决方案,但其中 none 有效。
driver.get("javascript:document.getElementById('overridelink').click();");
看起来类似于上面代码的东西可能会起作用,但 Microsoft Edge 上的安全证书页面在某些方面明显不同。
您需要做一些事情才能通过此安全证书屏幕。
- 定位desired_capabilitiesclass,应该定位
在你 Python 文件夹的某个地方。它将在文件 desired_capabilities.py.
中
i.e. C:\PythonXX\Lib\site-packages\selenium\webdriver\common
- 在desired_capabilities.py中,确保为
Microsoft Edge webdriver 已将 “javascriptEnabled” 设置为 “True”。
您可能需要为此添加代码。
在代码中遇到“安全证书”页面的部分,确认您在“安全证书”页面上,然后使用 javascript 到 select 继续选项。
if "Certificate error" in driver.title:
driver.get("javascript:document.getElementById('invalidcert_continue').click()")
Microsoft Edge 与 IE 中负责继续通过安全证书页面的对象名称不同。希望这有帮助。
我正在尝试使用 Python 绕过 Microsoft Edge for Selenium Webdriver 的安全证书页面。
我尝试了适用于我在此 thread 上找到的以前版本的 Internet Explorer 的解决方案,但其中 none 有效。
driver.get("javascript:document.getElementById('overridelink').click();");
看起来类似于上面代码的东西可能会起作用,但 Microsoft Edge 上的安全证书页面在某些方面明显不同。
您需要做一些事情才能通过此安全证书屏幕。
- 定位desired_capabilitiesclass,应该定位 在你 Python 文件夹的某个地方。它将在文件 desired_capabilities.py. 中
i.e. C:\PythonXX\Lib\site-packages\selenium\webdriver\common
- 在desired_capabilities.py中,确保为 Microsoft Edge webdriver 已将 “javascriptEnabled” 设置为 “True”。 您可能需要为此添加代码。
在代码中遇到“安全证书”页面的部分,确认您在“安全证书”页面上,然后使用 javascript 到 select 继续选项。
if "Certificate error" in driver.title: driver.get("javascript:document.getElementById('invalidcert_continue').click()")
Microsoft Edge 与 IE 中负责继续通过安全证书页面的对象名称不同。希望这有帮助。