3

I have a python code that uses selenium webdriver (along with chromedriver), to log into facebook and take a screenshot of the page.
the script itself works as expected, however, after logging in, chrome browser shows a dialog regarding facebook notifications (Chrome Popup)

The dialog seems to be generated by the browser, not the page itself.
i'm unable to identify and capture the element or use "switch to alert" method.

How can i interact with this dialog (either Allow, Dismiss or close it)?

Thanks!

3 Answers 3

4

in Python you can use

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--disable-notifications")
webdriver.Chrome(os.path.join(path, 'chromedriver'),
                 chrome_options=chrome_options)
Sign up to request clarification or add additional context in comments.

Comments

2

You can try with launching the chrome browser with disabled pop-ups (browser pop-ups). The following code snippet is in Java. It will be somewhat similar in python i believe.

ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-popup-blocking");
options.addArguments("test-type");
ChromeDriver driver = new ChromeDriver(options);

Comments

0

this worked for me in Python selenium:

chrome_options = Options()
chrome_options.add_argument("--disable-notifications")
driver = webdriver.Chrome(service=service_obj, options=chrome_options)

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.