如何使用seleniumpython在浏览器mob代理中处理SSL证书

如何使用seleniumpython在浏览器mob代理中处理SSL证书,python,selenium,Python,Selenium,我需要在浏览器mob代理中处理SSL证书,以便在URL以https开头时可以建立安全连接。我尝试了许多方法来处理SSL证书,但它显示了不安全的连接 from selenium import webdriver import requests import time from browsermobproxy import Server from selenium import webdriver import os from selenium.webdriver.common.desired_ca

我需要在浏览器mob代理中处理SSL证书,以便在URL以https开头时可以建立安全连接。我尝试了许多方法来处理SSL证书,但它显示了不安全的连接

from selenium import webdriver
import requests
import time
from browsermobproxy import Server
from selenium import webdriver
import os
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities


server = Server("/home/Downloads/browsermob-proxy-2.1.4-bin/browsermob-proxy-2.1.4/bin/browsermob-proxy")
server.start()
proxy = server.create_proxy(params={'trustAllServers':'true'})
chromeOptions = webdriver.ChromeOptions()
chromeOptions.add_argument("--proxy-server={0}".format(proxy.proxy))
r = requests.post('http://localhost:8080/proxy', data = {'trustAllServers':'true'})
capabilities = webdriver.DesiredCapabilities().CHROME
capabilities['acceptInsecureCerts'] = True
driver = webdriver.Chrome(chrome_options=chromeOptions, 
desired_capabilities=capabilities)
proxy.new_har("test",options={'captureHeaders': True})
driver.get("https://stackoverflow.com")
driver.close()

请添加相关标签。