Using Selenium Webdriver,I tried to open fb page after logging in. Once I logged in ,there is a pop up box appearing as follows
"Show notifications
Allow and Block"
I want to select "Allow" button.
I got an error message as
Exception in thread "main" org.openqa.selenium.NoAlertPresentException: no alert open
Please help.
Here is the code I wrote:
System.setProperty("webdriver.chrome.driver","C:\\Users\\ABCD\\Desktop\\chromedRiver.exe");
WebDriver driver=new ChromeDriver();
driver.get("http://www.facebook.com");
driver.findElement(By.xpath(".//*[@id='email']")).sendKeys("xxx");
driver.findElement(By.xpath(".//*[@id='pass']")).sendKeys("xxx");
driver.findElement(By.xpath(".//*[@id='u_0_m']")).click();
Thread.sleep(2000);
Alert alert=driver.switchTo().alert();
String msg= alert.getText();
System.out.println(msg);
Thread.sleep(2000);
alert.accept();