Loading

selenium屏蔽启动浏览器启动时的提示信息

代码

from selenium import webdriver
from selenium.webdriver import Remote
from webdriver_helper import debugger, get_webdriver

chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option('useAutomationExtension', False)
chrome_options.add_experimental_option("excludeSwitches", ['enable-automation'])
chrome_options.add_experimental_option("prefs", {"credentials_enable_service": False,
                                                         "profile.password_manager_enabled": False,
                                                         "profile.default_content_setting_values.notifications": 2})

driver = get_webdriver(ui_setting.driver_type, options=chrome_options)  # 启动浏览器
driver.set_window_size(1680, 1050)

posted @ 2022-12-12 14:31  DuKe渡客  阅读(179)  评论(0编辑  收藏  举报