How to use Desired Capabilties to handle browser notifications (was: ALERT of Facebook/ Unable to dismiss or accept)

As @Marek_Melocik mentioned, this is a browser-level notification (i.e. it has nothing to do with FB). You will need a desired capability to handle it. Unfortunately, I’m not familiar with the language of the alert in your screenshot, but here’s a way to figure out which desired capability you must add, and how to add it:

Can we use it? and how correctly?

How we can to send key to the browser, but not to the element,
using some code like this

this does not contain a solution to my question

That’s because you failed to provide any relevant info regarding to your issue. We (or at least me) do not understand Cyrillic alphabet and we don’t know what the alert is about.

So - please - tell us what you want to do. Accept, reject or just not display this notification.

I need to accept, reject or escape notification

And why the very first article in this topic does not work for you? It is about disabling notification (what you probably want to do) in order to test the FB application. Although it is for Chrome, there are other articles for other browser types.

1.there should be a simple function such as:


why did we go such a long way? because inefficient professionals

2.have you tried it yourself?

  1. i execute this:

ChromeOptions options = new ChromeOptions();
System.setProperty(“”, “/home/users/garima.pathak/Desktop/softwares/chromedriver”);
WebDriver driver =new ChromeDriver(options);


i have error

what is it?:


i dont have “chromedriver” anywhere

what gives it?:

Ok, let me explain you few things, which you may (not) like.

Katalon (as-is) is a great tool, which combines user-friendly interface and all advantages connected with Selenium WebDriver. It does not mean that it gives you everything you can get. Katalon provides you mainly wrappers over WebDriver’s keywords, which allow you to manipulate with DOM elements.

Your case cannot be solved using WebDriver, because the alert comes from browser, not from DOM. So yes, sometimes you have to use your own skills and do not rely on Katalon. I cannot imagine that every single possible action can be handled using Katalon’s keywords - they’d reinvent the wheel and Katalon would contain about 2 million of keywords.

From my perspective, insufficient profesional is a person, who is not able to find suitable solution even when (at least) one already exists. The main goal of Katalon is not to provide complete support, but rather it gives you an opportunity to customize your solution to perfectly match your needs - they don’t tell you use this solution, but rather you can use this or do it yourself in Java/Groovy. A tool, which contains everything you can think about, simply does not exist.

You may wonder, but most of my project consists of custom classes and methods. So yes, I’ve tried many things outside of Katalon world in my Katalon project.

It is a path to chromedriver - the default one is located in Katalon’s installation folder in \configuration\resources\drivers.

Finally - my advice - please ask some of your experienced colleagues to explain you the sources which we’ve posted here for you. This forum is designed to solve your partial issues with Katalon/WebDriver, not to teach you how to code and some coding basics. There are many other sites for this purposes.


Can anyone else write a normal working final code? which is clear at first glance for everyone and does not require extra thought and without problems

As I’ve said above, you need a desired capability:

Luckily for you, I’ve gone ahead and done all of your work for you and found which one you need.

It would serve you well to remember that none of us get paid to help you. We donate our time and expertise as best we can, and with our free time. Please remember this the next time you decide to act like a complete asshat.

To disable all notification popups permanently, do the following:

1.) Open Project > Settings > Desired Capabilities > WebUI > Chrome

2.) Click Add and set:

Name = prefs
Type = Dictionary

3.) Click on the ellipses under the Value column. The Dictionary Property Builder window will appear. Add a new property with:

Name = profile.default_content_setting_values.notifications
Type = Number
Value = 2.0

4.) Click OK, then OK again to apply the settings.


God forbid you have to think to solve your problems…


Check the below Forum :

This is the working final code.

import org.openqa.selenium.WebDriver
import com.kms.katalon.core.webui.driver.DriverFactory

Map<String, Object> chromePrefs = new HashMap<String, Object>()
chromePrefs.put("profile.default_content_setting_values.notifications", 2)
System.setProperty("", DriverFactory.getChromeDriverPath())
ChromeOptions options = new ChromeOptions()
options.setExperimentalOption("prefs", chromePrefs)
WebDriver driver = new ChromeDriver(options)

WebUI.navigateToUrl('your URL')

Thank you for sharing the final solution.

1 Like

I’ve changed the Solution to @Brandon_Hein’s post since it sets the property for ALL test cases, not merely inline for one Test Case.

And then I closed the thread.