Handling alerts in Webdriver :
Import this package in your script.
#import org.openqa.selenium.Alert;
For accepting the alert box:
Alert al = driver.switchTo ().alert ();
al.accept ();
Alert al = driver.switchTo ().alert ();
al.dismiss ();
For getting the text of the alert box:
Alert al = driver.switchTo ().alert ();
String s = al.getText();
System.out.println(s);
How to handle Authentication alert boxes?? Can you explain?
ReplyDeleteThanks
Hi Tester,
ReplyDeleteDid you mean, SSL alert/Security alert? Or
Username, Password authentication??
Thanks
Anitha
Uname & Pwd authentication.
ReplyDeleteUsing AutoIT, we can handle this type of alerts. We will share the AutoIT scripts very shortly.
ReplyDelete