硒相互作用:您的连接不是私有的 [英] Selenium interacting with: your connection is not private

查看:144
本文介绍了硒相互作用:您的连接不是私有的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试与您的连接不是私有的页面进行交互。

I'm trying to interact with the page "Your connection is not private".

使用 options.add_argument(' --ignore-certificate-errors')无效,有两个原因:

The solution of using options.add_argument('--ignore-certificate-errors') is not helpful for two reasons:


  1. 我正在使用已经打开的窗口。

  2. 即使我使用的是硒打开的窗口,脚本也不会停止运行,而我要解决的问题是当我的浏览器与混合仪表板断开连接时我希望它再次自动连接(并弹出私人连接窗口)。

所以问题是-我如何单击在高级上,然后单击继续到splunk_server(不安全)?

So the question is - How do i click on "Advanced" and then click on "Proceed to splunk_server (unsafe)?

如果答案可能在python中,它甚至会提供更多帮助:)

If the answer could be in python it will even help more :)

谢谢

推荐答案

适用于Chrome:

from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_argument('--ignore-ssl-errors=yes')
options.add_argument('--ignore-certificate-errors')
driver = webdriver.Chrome(options=options)

如果不起作用,则此操作:

If not work then this:

ChromeOptions options = new ChromeOptions()
chrome_options.add_argument('--allow-insecure-localhost')
DesiredCapabilities caps = DesiredCapabilities.chrome()
caps.setCapability(ChromeOptions.CAPABILITY, options)
caps.setCapability("acceptInsecureCerts", true)
WebDriver driver = new ChromeDriver(caps)

对于Firefox:

from selenium import webdriver

profile = webdriver.FirefoxProfile()
profile.accept_untrusted_certs = True

driver = webdriver.Firefox(firefox_profile=profile)
driver.get('https://cacert.org/')

driver.close()

如果不行,那就这样:

capabilities = webdriver.DesiredCapabilities().FIREFOX
capabilities['acceptSslCerts'] = True
driver = webdriver.Firefox(capabilities=capabilities)
driver.get('https://cacert.org/')
driver.close()

以上都为我工作!

这篇关于硒相互作用:您的连接不是私有的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆