下载google浏览器对应的webdriver :
https://blog.csdn.net/weixin_41522164/article/details/82775735
下载 browsermob-proxy 插件:
https://github.com/lightbody/browsermob-proxy
具体实现代码
import time
import pandas as pd
from selenium import webdriver
from browsermobproxy import Server
from selenium.webdriver.chrome.options import Options
server = Server(r'E:\code\000-render-tools\python-spider-master\subwaymap\browsermob-proxy-2.1.4\bin\browsermob-proxy.bat')
server.start()
proxy = server.create_proxy()
chrome_options = Options()
chrome_options.add_argument('--ignore-certificate-errors')
chrome_options.add_argument('--proxy-server={0}'.format(proxy.proxy))
driver = webdriver.Chrome(chrome_options=chrome_options)
proxy.new_har("amap", options={