How to handle show notifications pop up on Chrome in Geb(Java)?

Tell me the method to handle show notifications pop up on Chrome in Geb(Java).

Hello Tim,

You can use this sample script to allow notification pop-up in Chrome:


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>();
contentSettings.put("notifications", 1);
profile.put("managed_default_content_settings", contentSettings);
prefs.put("profile", profile);
options.setExperimentalOption("prefs", prefs);


caps.setCapability(ChromeOptions.CAPABILITY, options);

WebDriver driver = new RemoteWebDriver(new URL(URL), caps);

driver.get("https://web-push-book.gauntface.com/demos/notification-examples/");
driver.findElement(By.xpath("//body/main[1]/p[3]/input[1]")).click();