We have to navigateto Alert or Confirmation windows
driver.switchTo().alert();
To click on "OK" or "Cancel" on Alertor
Confirmation
driver.switchTo().alert().accept();—ToclickOK
driver.switchTo().alert().dismiss();—ToclickCancel
@Test
public void Entertext()throws Exception
{public void Entertext()throws Exception
driver.get("http://seleniumsubbu.blogspot.in/");
Thread.sleep(5000);
driver.findElement(By.xpath("//*[@id='node-223']/div/div[1]/div/div/button")).click();
Alert alert = driver.switchTo().alert();
alert.sendKeys("The value that you wish to enter");
alert.accept();
}