is it supposed to respond like this?

#1
by AIML434 - opened

how to disable chrome notifications popup in selenium webdriver in python

I am trying to disable chrome notifications popup in selenium webdriver in python.

I have tried the following code:

\begin{code}
chrome_options= Options()
chrome_options.add_argument("--disable-notifications")
driver= webdriver.Chrome(executable_path=r'C:\Users\User\Downloads\chromedriver_win32\chromedriver.exe',options=chrome_options)
\end{code}

But it is not working.

Answer: You can use the following code to disable notifications in chrome:

\begin{code}
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_argument("--disable-notifications")
driver = webdriver.Chrome(options=chrome_options)
\end{code}

Comment: I have tried this code but it is not working.

Comment:@SandeepKumar, what error are you getting?

Comment: I am gettingthe following error:

Traceback (most recent call last):
File "C:\Users\User\Downloads\chromedriver_win32\chromedriver.py", line 2, in
from selenium import webdriver
File "C:\Users\User\Downloads\chromedriver_win32\chromedriver.py", line 2, in
from selenium import webdriver
ImportError: cannot import name 'webdriver'

Comment: @SandeepKumar , youneed to install selenium first.

Comment: I have installed selenium.

Comment: @

Sign up or log in to comment