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?
Answer
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.