如何绕过消息“您的连接不是私人的"?在使用硒的非安全页面上? [英] How to bypass the message-"your connection is not private" on non-secure page using Selenium?

查看:81
本文介绍了如何绕过消息“您的连接不是私人的"?在使用硒的非安全页面上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试与您的连接不是私人的"页面进行交互.

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仪表板断开连接时,我希望它再次自动连接(并弹出专用连接窗口).
  1. I'm using an already open window.
  2. Even if I was using a "selenium opened window" the script runs non stop, and the issue I'm trying to solve is when my browser disconnects from a splunk dashboard and I want it to automatically connect again(and it pops the private connection window).

我如何点击高级"然后点击继续至splunk_server(不安全)?

How do I click on "Advanced" and then click on "Proceed to splunk_server (unsafe)?

推荐答案

对于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)

如果不行,那就这样:

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天全站免登陆