[scrapy] 2024-10-03 圈点499
摘要:selenium访问http(非https)时提示安全问题或非信任站点的三种浏览器处理方法
selenium访问http(非https)时提示安全问题或非信任站点处理
1,chrome,
from selenium import webdriver
options=webdriver.ChromeOptions()
options.add_argument('--ignore-certificate-errors')
driver=webdriver.Chrome(chrome_options=options)
2,firefox
from selenium import webdriver
profile=webdriver.FirefoxProfile()
profile.accept_untrusted_certs=True
driver=webdriver.Firefox(firefox_profile=profile)
3,IE:
from selenium import webdriver
capabilities = webdriver.DesiredCapabilities().INTERNETEXPLORER
capabilities['acceptSslCerts'] = True
driver = webdriver.Ie(capabilities=capabilities)