python selenium处理浏览器弹框:始终允许某个网站

# 创建 ChromeOptions 对象并添加启动参数
options = webdriver.ChromeOptions()
options.add_argument('--allow-running-insecure-content')
options.add_argument('--allow-file-access-from-files')

# 在 ChromeOptions 中添加自定义 Prefs 参数
prefs = {
    'profile.default_content_setting_values': {
        'clipboard': 1
    }
}
options.add_experimental_option('prefs', prefs)

driver = webdriver.Chrome(desired_capabilities=caps, options=options)

posted on 2023-09-13 16:34  bbzhang  阅读(186)  评论(0)    收藏  举报

导航