Enabling popup windows in Chrome by Selenium

0
0

My apologies in advance if my question sounds primary, I am very new at QA and Selenium.

I am using Java and Selenium to write a test, at one of my test’s step when I click on a button it is supposed to open another window but Chrome blocks the popup window, can I enable popup by Selenium?

  • You must to post comments
0
0

Well, you need to initialize the ChromeDriver with a customized configuration which will disable the flag to block popups. From this site, the command line switch for it is disable-popup-blocking. So, using ChromeOptions and DesiredCapabilities, you add the desired config using the DesiredCapabilities.setCapability() function.

ChromeOptions options = new ChromeOptions();
options
.addArguments("test-type");
options
.addArguments("disable-popup-blocking");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities
.setCapability(ChromeOptions.CAPABILITY, options);
WebDriver driver = new ChromeDriver(capabilities);

EDIT: Just found the same solution on this site.

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website