Enable and Disable Pop-Ups

Enable pop-ups

You can enable pop-ups in Chrome, IE and Safari as follows:

Select a browser:

Chrome v43 and above

Pop-ups are enabled by default (as the pop-up blocker is disabled by default).

If you enabled the pop-up blocker using the steps in the next section, remove the code that enables the pop-up blocker.

Chrome v42 and older

To enable pop-ups, you have to disable the pop-up blocker by creating a chromeOptions capability, and passing the --disable-popup-blocking argument.

ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-popup-blocking");
caps.setCapability(ChromeOptions.CAPABILITY, options);
var capabilities = {
  "browserName" : "chrome",
  "chromeOptions" : {
    "args" : ["--disable-popup-blocking"]
  }
}
using OpenQA.Selenium.Chrome;

DesiredCapabilities capability;
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.AddArgument("--disable-popup-blocking");
capability = (DesiredCapabilities)chromeOptions.ToCapabilities();
$chromeoptions = array("args"=>array("--disable-popup-blocking"));
$caps = array("platform"=>"WINDOWS", "browserName"=>"chrome", "chromeOptions"=>$chromeoptions);
caps = DesiredCapabilities.CHROME
caps["chromeOptions"] = {}
caps["chromeOptions"]["args"] = ["--disable-popup-blocking"]
$caps->{"chromeOptions"} = { "args" => ("--disable-popup-blocking") };

To enable the popups in IE, use the browserstack.ie.enablePopups capability.

caps.setCapability("browserstack.ie.enablePopups", "true");
caps["browserstack.ie.enablePopups] = "true"
desiredCap.SetCapability("browserstack.ie.enablePopups", "true");
caps["browserstack.ie.enablePopups"] = "true"
var capabilities = {
  "browserstack.ie.enablePopups" : "true"
}
$caps["browserstack.ie.enablePopups"] = "true";
$caps->{"browserstack.ie.enablePopups"} = "true";

To enable the popups in Safari, use the browserstack.safari.enablePopups capability.

caps.setCapability("browserstack.safari.enablePopups", "true");
caps["browserstack.safari.enablePopups] = "true"
desiredCap.SetCapability("browserstack.safari.enablePopups", "true");
caps["browserstack.safari.enablePopups"] = "true"
var capabilities = {
  "browserstack.safari.enablePopups" : "true"
}
$caps["browserstack.safari.enablePopups"] = "true";
$caps->{"browserstack.safari.enablePopups"} = "true";

Disable pop-ups

You can disable pop-ups in Chrome, IE and Safari as follows:

Chrome v43 and above

To enable the popup blocker, create a chromeOptions capability, and pass the disable-popup-blocking as excludeSwitches.

ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("excludeSwitches", "disable-popup-blocking");
caps.setCapability(ChromeOptions.CAPABILITY, options);
caps = Selenium::WebDriver::Remote::Capabilities.chrome
caps["chromeOptions"] = {}
caps["chromeOptions"]["excludeSwitches"] = ["disable-popup-blocking"]
using OpenQA.Selenium.Chrome;

DesiredCapabilities capability;
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.AddAdditionalCapability("excludeSwitches", "disable-popup-blocking");
capability = (DesiredCapabilities)chromeOptions.ToCapabilities();
caps = DesiredCapabilities.CHROME
caps["chromeOptions"] = {}
caps["chromeOptions"]["excludeSwitches"] = ["disable-popup-blocking"]
var capabilities = {
  "browserName" : "chrome",
  "chromeOptions" : {
    "excludeSwitches" : ["disable-popup-blocking"]
  }
}
$chromeoptions = array("excludeSwitches"=>array("disable-popup-blocking"));
$caps = array("platform"=>"WINDOWS", "browserName"=>"chrome", "chromeOptions"=>$chromeoptions);
$caps->{"chromeOptions"} = { "excludeSwitches" => ("disable-popup-blocking") };

Chrome v42 and older

Pop-ups are disabled by default. If you enabled them using the steps in the previous section, remove the code that disables the pop-up blocker.

Pop-ups are disabled by default. If you enabled them using the steps in the previous section, remove the code that enables the pop-ups.

Pop-ups are disabled by default. If you enabled them using the steps in the previous section, remove the code that enables the pop-ups.

We're sorry to hear that. Please share your feedback so we can do better






Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback