python +selenium+chrome关闭保存密码弹窗和关闭chrome受自动控制提示
作者:互联网
from selenium import webdriver
from time import sleep
import os
chrome_options = webdriver.ChromeOptions()
prefs = {"": “”}
prefs[“credentials_enable_service”] = False
prefs[“profile.password_manager_enabled”] = False
chrome_options.add_experimental_option(“prefs”, prefs) ##关掉密码弹窗
chrome_options.add_argument(’–disable-gpu’) # 谷歌文档提到需要加上这个属性来规避bug
chrome_options.add_argument(‘lang=zh_CN.UTF-8’) # 设置默认编码为utf-8
chrome_options.add_experimental_option(‘useAutomationExtension’, False) # 取消chrome受自动控制提示
chrome_options.add_experimental_option(“excludeSwitches”, [‘enable-automation’]) # 取消chrome受自动控制提示
browser = webdriver.Chrome(os.getcwd()+"\chromedriver.exe",0, options=chrome_options) # 参数的写入
browser.get(“https://www.baidu.com”)
标签:option,chrome,python,add,关闭,import,prefs,options 来源: https://blog.csdn.net/wuhuanqi1/article/details/117519688