Handle alerts
driver.switchTo().Alert();
alert.accept()// clicked on ok
alert.dismiss(); //clicked on cancel
driver.switchTo().Alert();
alert.accept()// clicked on ok
alert.dismiss(); //clicked on cancel
for example:
public void alert(){ String str=driver.switchTo().alert().getText(); System.out.println(str); driver.switchTo().alert().accept(); //driver.switchTo().alert().dismiss(); }
Really nice topics you had discussed above. I am much impressed. Thank you for providing this nice information here.
ReplyDeleteSoftware Testing Company
QA Services
Game Testing Services
Video Game Testing Companies