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
3,849 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,930 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,520 points
7,579 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
9,583 views
0 votes
2 answers

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

JavascriptExecutor jsx = (JavascriptExecutor)driver; jsx.executeScript("window.scrollBy(0,555)", ""); or Action classes ...READ MORE

answered Sep 5 in Selenium by Sri
• 2,970 points
13,543 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,710 points
7,760 views
0 votes
2 answers

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,520 points
3,779 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31 in Selenium by Sri
• 2,970 points
4,762 views
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
2,740 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 2 in Selenium by Sri
• 2,970 points
3,107 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,930 points
10,281 views
0 votes
2 answers

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

Alert alertCancel = driver.switchTo().alert(); READ MORE

answered Sep 5 in Selenium by Sri
• 2,970 points
6,998 views