How to handle show notifications pop-up on Chrome with Java-Cucumber?
Hi Macy,
To handle show notifications pop-up on Chrome with Java-Cucumber, you can use this sample code snippet below:
// INIT CHROME OPTIONS
ChromeOptions options = new ChromeOptions();
Map<String, Object> prefs = new HashMap<String, Object>();
Map<String, Object> profile = new HashMap<String, Object>();
Map<String, Object> contentSettings = new HashMap<String, Object>();
// SET CHROME OPTIONS
// 0 - Default, 1 - Allow, 2 - Block
contentSettings.put("notifications", 1);
profile.put("managed_default_content_settings", contentSettings);
prefs.put("profile", profile);
options.setExperimentalOption("prefs", prefs);