使用chromeoptions来修改浏览器的设置
from selenium import webdriver
import time
options = webdriver.ChromeOptions()
prefs = {
'profile.default_content_setting_values' :
{
'notifications' : 2
}
}
options.add_experimental_option('prefs',prefs)
driver = webdriver.Chrome(chrome_options = options)
driver.get("https://www.facebok.com/")
driver.implicitly_wait(10)
time.sleep(2)