SwitchTo()...
Alert:
Alert alert = driver.switchTo().alert();
alert.accept();
- To get the text in the alert box, use something like alert.getText()
- If you get multiple alert boxes(that means handled you get ono more). -----Alert????
If I need to select ok on one alert box and then cancel on next alert box.
getText() -- help us to find the text of alert box, so write condition with text method, based on content mention alert object accept() or cancel() methods.
- You will sometime not get alert but code written, so make use of exception handler. Saying that if there is not alert handle it saying that code should be continued.
-
Alert:
Alert alert = driver.switchTo().alert();
alert.accept();
- To get the text in the alert box, use something like alert.getText()
- If you get multiple alert boxes(that means handled you get ono more). -----Alert????
If I need to select ok on one alert box and then cancel on next alert box.
getText() -- help us to find the text of alert box, so write condition with text method, based on content mention alert object accept() or cancel() methods.
- You will sometime not get alert but code written, so make use of exception handler. Saying that if there is not alert handle it saying that code should be continued.
-
No comments:
Post a Comment