0

Problem Description - Upon clicking a link on the page, popup got blocked automatically.

   file = new File("tools/chromedriver.exe");
   System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
   caps.setCapability("ignoreZoomSetting", true);
   caps.setCapability("nativeEvents", false);
   driver = new ChromeDriver(caps);

Environment used – Selenium WebDriver – 2.43.0 ChromeDriver, Windows 7

Note – it is working fine on Firefox & IE, this issue is happening on Chrome only.

Please assist on this.

VVV
  • 68
  • 1
  • 14

2 Answers2

0

This is a Chrome Option to disable all popups for the site

  • Open Chrome.
  • Find a page that has pop-ups blocked for you.
  • At the end of the address bar, click the pop-up blocker icon chrome op-up locked.
  • Click the link for the pop-up window you'd like to see.
  • To always see pop-ups for the site, select Always show pop-ups from [site]. Once you have this set use the profile it is saved against to load for the test Another option is to open the site and Shift F5 to do a Cache Refresh Load a Profile. The code below is C# and you haven't specified a language. Please see the links provided for Java examples
ChromeOptions options = new ChromeOptions();
userDataPath = "C:/Users/user_name/AppData/Local/Google/Chrome/User Data";
options.AddArguments("user-data-dir=" + userDataPath);
options.AddArguments("--start-maximized");
driver = new ChromeDriver("pathToChromeDriver", options);
Community
  • 1
  • 1
lloyd
  • 1,683
  • 2
  • 19
  • 23
0

You can pass the chromeOption to allow pop-up as shown in below:

Map<String, Object> prefs = new HashMap<String, Object>();
prefs.put("profile.default_content_setting_values.popups", 1);
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", prefs);
WebDriver driver = new ChromeDriver(options);
srees
  • 276
  • 1
  • 4