1

How can Selenium undetected_Chrome WebDriver notifications be handled in Python?

Have tried to dismiss/accept alert and active element but seems notifications have to be treated other way. Thats what I tried:

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)

But didn't work.
Thanks in advance.
notifications

2 Answers 2

2

Try the latest version 3.1.3

https://pypi.org/project/undetected-chromedriver/

there are some differences in defining options and executable path:

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://...') 
Sign up to request clarification or add additional context in comments.

Comments

2
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')

How to click Allow on Show Notifications popup using Selenium Webdriver Hello) Pass the argument 1 to allow and 2 to block

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.