selenium设置chrome请求头

# 进入浏览器设置
options = webdriver.ChromeOptions()
# 设置中文
options.add_argument('lang=zh_CN.UTF-8')
# 更换头部
options.add_argument('user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36"')
# 创建浏览器对象
driver = webdriver.Chrome(chrome_options=options)
posted @ 2020-02-24 21:54  田智凯  阅读(8451)  评论(0编辑  收藏  举报