如何在 Python 中處理 Selenium undetected_Chrome WebDriver 通知?
已嘗試關閉/接受警報和活動元素,但似乎必須以其他方式處理通知。這就是我嘗試過的:
option = Options()
# Working with the 'add_argument' Method to modify Driver Default Notification
option.add_argument('--disable-notifications')
# Passing Driver path alongside with Driver modified Options
browser = webdriver.Chrome(executable_path= your_chrome_driver_path, chrome_options= option)
但是沒有用。
提前致謝。
通知
uj5u.com熱心網友回復:
嘗試最新版本 3.1.3
https://pypi.org/project/undetected-chromedriver/
定義選項和可執行路徑有一些區別:
import undetected_chromedriver as webdriver
options = webdriver.ChromeOptions()
options.add_argument('--disable-notifications')
driver = webdriver.Chrome(browser_executable_path=your_chrome_driver_path, options=options)
driver.get('https://...')
uj5u.com熱心網友回復:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
option = Options()
option.add_argument("--disable-infobars")
option.add_argument("start-maximized")
option.add_argument("--disable-extensions")
# Pass the argument 1 to allow and 2 to block
option.add_experimental_option("prefs", {
"profile.default_content_setting_values.notifications": 1
})
driver = webdriver.Chrome(chrome_options=option, executable_path='path-of-
driver\chromedriver.exe')
driver.get('https://www.facebook.com')
如何使用 Selenium Webdriver 在顯示通知彈出視窗中單擊 允許
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/421977.html
標籤:
上一篇:檢測按下了什么按鈕
下一篇:重試Selenium點擊
