Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Selenium “如何禁用”;将非安全来源标记为“非安全”;在硒测试中?_Selenium_Google Chrome_Http_Selenium Chromedriver_Saucelabs - Fatal编程技术网

Selenium “如何禁用”;将非安全来源标记为“非安全”;在硒测试中?

Selenium “如何禁用”;将非安全来源标记为“非安全”;在硒测试中?,selenium,google-chrome,http,selenium-chromedriver,saucelabs,Selenium,Google Chrome,Http,Selenium Chromedriver,Saucelabs,我在测试中运行非http url(所以迁移到https并不容易),正因为如此,我在浏览器中得到了警告 如何在硒测试期间禁用Chrome内部的“非安全”警告 我试着玩弄争论,但都没用 args: [ 'start-maximized', 'disable-webgl', 'blacklist-webgl', 'black

我在测试中运行非http url(所以迁移到https并不容易),正因为如此,我在浏览器中得到了警告

如何在硒测试期间禁用Chrome内部的“非安全”警告

我试着玩弄争论,但都没用

 args: [
                      'start-maximized',
                      'disable-webgl',
                      'blacklist-webgl',
                      'blacklist-accelerated-compositing',
                      'disable-accelerated-2d-canvas',
                      'disable-accelerated-compositing',
                      'disable-accelerated-layers',
                      'disable-accelerated-plugins',
                      'disable-accelerated-video',
                      'disable-accelerated-video-decode',
                      'disable-gpu',
                      'disable-infobars',
                      'test-type',
                      'disable-extensions',
                      'allow-running-insecure-content',
                      'disable-web-security',
                      'ignore-certificate-errors',
                      'ignore-gpu-blacklist',
                      'no-default-browser-check',
                      'no-first-run',
                      'disable-default-apps'
                  ]
问题是,我需要将窗口大小调整为420x800,但由于警告,浏览器无法执行此操作。

“不安全”SSL错误 随着Chrome68的发布,谷歌开始在Chrome浏览器上显示所有HTTP站点为不安全


HTTP页面的处理

通过访问
chrome://flags/#enable-将http标记为
,并设置以下属性:

  • 将非安全源代码标记为非安全:更改Mac、Windows、Linux、Chrome OS和Android上HTTP页面的UI处理方式
    • 违约
    • 启用
    • 已启用(标记为活动危险)
    • 已启用(在表单编辑时标记非安全警告和危险)
    • 残废

使用Selenium禁用此功能时,您需要使用ChromeOption
——允许运行不安全的内容,如下所示:

  • Python:

“不安全”SSL错误 随着Chrome68的发布,谷歌开始在Chrome浏览器上显示所有HTTP站点为不安全


HTTP页面的处理

通过访问
chrome://flags/#enable-将http标记为
,并设置以下属性:

  • 将非安全源代码标记为非安全:更改Mac、Windows、Linux、Chrome OS和Android上HTTP页面的UI处理方式
    • 违约
    • 启用
    • 已启用(标记为活动危险)
    • 已启用(在表单编辑时标记非安全警告和危险)
    • 残废

使用Selenium禁用此功能时,您需要使用ChromeOption
——允许运行不安全的内容,如下所示:

  • Python:


你能用
不安全警告的快照更新问题吗?对你有帮助吗?@DebanjanB我看到了。当你用自己生成的证书测试https时,它看起来像是一个解决方案,在我的例子中,它就是https。你能用
不安全的
警告的快照更新问题吗?对你有帮助吗?@DebanjanB我看到了。当您使用自生成的证书测试https时,它看起来像一个解决方案,在我的情况下,它只是httpIts不工作,如果您在原始问题中看到我有“允许运行不安全的内容”,它不工作,如果您在原始问题中看到我有“允许运行不安全的内容”,
chrome_options = webdriver.ChromeOptions() 
chrome_options.add_argument("start-maximized")
chrome_options.add_argument('disable-infobars')
chrome_options.add_argument('--allow-running-insecure-content')
driver = webdriver.Chrome(chrome_options=chrome_options, executable_path=r'C:\Utility\BrowserDrivers\chromedriver.exe')
driver.get("http://www.legislation.vic.gov.au/")