gpt4 book ai didi

python - 绕过 Microsoft Edge 上的 Selenium Webdriver 安全证书页面

转载 作者:太空宇宙 更新时间:2023-11-04 00:56:40 24 4
gpt4 key购买 nike

我正在尝试使用 Python 绕过 Microsoft Edge for Selenium Webdriver 的安全证书页面。

enter image description here

我尝试了适用于我在此 thread 上找到的以前版本的 Internet Explorer 的解决方案, 但它们都不起作用。

driver.get("javascript:document.getElementById('overridelink').click();");

看起来接近上述代码的东西可能会起作用,但 Microsoft Edge 上的安全证书页面在某些方面明显不同。

最佳答案

要通过此安全证书屏幕,您需要做一些事情。

  • 找到 desired_capabilities 类,它应该位于在你的 Python 文件夹中的某个地方。它会在文件 desired_capabilities.py 中。

i.e. C:\PythonXX\Lib\site-packages\selenium\webdriver\common

  • desired_capabilities.py 中,确保为Microsoft Edge webdriver 已将 “javascriptEnabled” 设置为 “True”。您可能需要为此添加代码。

enter image description here

  • 在遇到“安全证书”页面的代码部分中,确认您位于“安全证书”页面上并使用 javascript 选择继续选项。

    if "Certificate error" in driver.title:
    driver.get("javascript:document.getElementById('invalidcert_continue').click()")

负责继续通过安全证书页面的对象名称对于 Microsoft Edge 与 IE 不同。希望这会有所帮助。

关于python - 绕过 Microsoft Edge 上的 Selenium Webdriver 安全证书页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34800960/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com