I am writing a code for Facebook where it takes the URL, ID, Password from a properties file but upon logging in I am hinted with a "Facebook wants to show notifications - Allow - Block" How do I make it so after login it (A.) Presses ESP or ALT+F4 and closes the popup or (B.) Finds the notification and closes it itself. This is what Im using but its not working. Any help is appreciated.
public void closePopup() throws InterruptedException{
Thread.sleep(1000);
Actions action=new Actions(driver);
action.keyDown(Keys.ESCAPE).keyUp(Keys.ESCAPE).build().perform();
After further research I found my answer. It is a chrome notification so here is the required step to solve my problem.
ChromeOptions ops = new ChromeOptions();
ops.addArguments("--disable-notifications");
System.setProperty("webdriver.chrome.driver", "./lib/chromedriver");
driver = new ChromeDriver(ops);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With