使用python+selenium驅動chrome作自動化測試是一個很常見的場景,之前使用chrome時頁面頭部出現了一個小黃條報錯提示「您使用的是不受支持的命令行標記:--ignore-certificate-errors。穩定性和安全性會有所降低」,能夠經過設置chrome的option屬性解決。python
問題重現 web
使用python+selenium驅動chrome,頁面出現小黃條報錯「您使用的是不受支持的命令行標記:--ignore-certificate-errors。穩定性和安全性會有所降低」chrome
# -*- coding=UTF-8 -*- from selenium import webdriver import time import sys browser = webdriver.Chrome() browser.get("http://my.oschina.net/rasine") print "the page is opend!"
問題解決 安全
使用option參數,該問題能夠解決測試
options = webdriver.ChromeOptions()spa
options.add_experimental_option("excludeSwitches", ["ignore-certificate-errors"]).net
browser = webdriver.Chrome(chrome_options=options)命令行