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

i use
WebUI.dismissAlert()

1 Like

What we can do now?

Can you please share your script - i assume its because you dont have a waitForElementVisible

its have sleep (5000) before, i see this alert,
but it not work

Maybe its not Alert?

It is not JS alert, but browser’s notification. Read more:

not a good enough solution

Have you tried just recording it ? does it pick up the element?

its difficult to me

may be this

import org.openqa.selenium.chrome.ChromeDriver
WebDriver driver = new ChromeDriver()
driver.keys("Escape")

this needs to be corrected to make them work. i can`t. Help

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?

https://docs.katalon.com/katalon-studio/tutorials/using_selenium_webdriver_katalon_studio.html

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:

WebUI.dismissAlert()

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

2.have you tried it yourself?