How to disable pop up and alert windows in Firefox browser using Selenium?

0 votes
How to disable pop up and alert windows in Firefox browser using Selenium?
May 20, 2019 in Selenium by Ranjan
1,336 views

1 answer to this question.

0 votes

Hey Ranjan, you can use these lines of code to disable a popup or alert window in Firefox browser using Selenium. There is a preference called dom.disable_beforeunload. You should change its value to true. With Selenium, you can create a new customized Firefox profile:

import org.openqa.selenium.chrome.FirefoxDriver;

import org.openqa.selenium.chrome.Preferences;

FirefoxProfile customProfile = new FirefoxProfile();

customProfile.setPreference("dom.disable_beforeunload", true);

FirefoxDriver driver = new FirefoxDriver(customProfile);
answered May 21, 2019 by Abha
• 27,720 points

Related Questions In Selenium

0 votes
1 answer

How to handle Pop-up in Selenium WebDriver using Java

Actually, its pretty simple. Use this code ...READ MORE

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

How to switch between two windows in browser using Selenium java

Yes, this is possible. First, you need ...READ MORE

answered Sep 25, 2018 in Selenium by Meci Matt
• 9,460 points
4,594 views
0 votes
1 answer

How to scroll the Page up or down in Selenium WebDriver? (using java)

Its pretty simple. Check out the below ...READ MORE

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

How to Check if any alert exists in selenium using Python

This might work for you. It did ...READ MORE

answered May 10, 2018 in Selenium by king_kenny
• 3,670 points
4,654 views
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
1,485 views
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,850 points
1,462 views
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,850 points
1,223 views
0 votes
1 answer

How to open new tab in same browser and switch between them using Selenium?

Hi Mugdha, you can use following code ...READ MORE

answered May 24, 2019 in Selenium by Abha
• 27,720 points
2,202 views
0 votes
1 answer

How to avoid the pop-up window in chrome browser with Selenium?

Hi Naresh, its actually pretty easy to ...READ MORE

answered Oct 10, 2019 in Selenium by Abha
• 27,720 points
1,445 views