Popup blocking in Google Chrome causing issues with Capybara/Rspec tests

We had a very similar problem. Like John says, the command-line switch no longer works. We tried using a custom profile, but it seemed to be overwritten.

Eventually solved it by manually disabling popups using WebDriver itself:

driver.get('chrome://settings/advanced')
driver.find_element_by_id('privacyContentSettingsButton').click()
driver.find_element_by_name('popups').click()

Which, I guess, is more like what the user would do anyway ;-)


You can call driver with options.

ChromeOptions options = new ChromeOptions();
options.addArguments("-incognito");
options.addArguments("--disable-popup-blocking");

ChromeDriver driver = new ChromeDriver(options);