Click Allow on Show Notifications popup using Selenium Webdriver

0 votes

I'm trying to login to Facebook. After a successful login, I get a browser popup:

Can I click Allow and proceed forward using selenium webdriver?

Jun 20, 2018 in Selenium by Martin
• 4,330 points
sorry no allow this code because i am using
Can you please be little more specific? Can't really understand what you're trying to say.
i am facing this issue on windows using python in selenium

Try this:

alert_obj = driver.switch_to.alert
@Omkar, have you tried the code that you have written coz its not working for me
Hey @Nischitha what error are you getting?

try the below one to allow/block the permission

1- allow, 2-block


ChromeOptions options=new ChromeOptions();
Map prefs=new HashMap();
prefs.put(“profile.default_content_setting_values.notifications”, 1);
ChromeDriver driver=new ChromeDriver(options);


WebDriver driver ;
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference(“permissions.default.desktop-notification”, 1);
DesiredCapabilities capabilities=DesiredCapabilities.firefox();
capabilities.setCapability(FirefoxDriver.PROFILE, profile);
driver = new FirefoxDriver(capabilities);
driver.get(“your Web site”);

2 answers to this question.

+1 vote

Create a instance of ChromeOptions class

ChromeOptions options = new ChromeOptions();

Then Add chrome switch to disable notification - "--disable-notifications"


After that set path for driver exe


and then pass ChromeOptions instance to ChromeDriver Constructor

WebDriver driver =new ChromeDriver(options);

answered Jun 20, 2018 by Samarpit
• 5,890 points
But the request is not to disable notifications. The request is to click "Allow".
@pinkninjatester, unfortunately there is no option to do that. Because the above subject is not treated as a browser popup, but infact it is treated as a browser notification.

Disabling this notification should hopefully solve your problem as the execution will continues without any hindrance. Let me know if anything otherwise happens :)
+1 vote
Try this:

Robot robot = new Robot();

hope this will help you.
answered Feb 29 by anuj
Prefect! It worked for me. Thank you.
thanks  it worked for me also in chrome version 81

Related Questions In Selenium

0 votes
1 answer

How to click on a hyperlink using Selenium WebDriver?

Hi Jonathan, you can use click() method in ...READ MORE

answered May 29, 2019 in Selenium by Abha
• 27,930 points
0 votes
1 answer

Double click a record in a grid using Selenium webdriver

Try Actions class to perform this Actions action ...READ MORE

answered Mar 29, 2018 in Selenium by Damon Salvatore
• 5,540 points
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,510 points
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,890 points
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,890 points
0 votes
1 answer

Wait until page loads before click() using Selenium Webdriver

Change the following guestlogin_button = wait.until(EC.visibility_of_element_located((, ".ch4_loginGuestBtn"))) to guestlogin_button = ...READ MORE

answered Aug 8, 2018 in Selenium by Samarpit
• 5,890 points
0 votes
1 answer

Firefox browser not opening with given URL using Selenium Webdriver with Java

Download the latest selenium jar and replace ...READ MORE

answered Apr 30, 2018 in Selenium by Samarpit
• 5,890 points