How to Handle Unexpected alert using selenium RC

54 views
Skip to first unread message

Yuva

unread,
Aug 20, 2014, 7:54:45 AM8/20/14
to seleniu...@googlegroups.com
Hi All,

Please let me know how to handle Unexpected alert using selenium RC.

I tried below commands but I am unable to click OK button.So please help here to resolve the issue

$sel->getAlert();
$sel->chooseOkOnNextConfirmation();
$sel->chooseCancelOnNextConfirmation();
$sel->answerOnNextPrompt();



Robin Gupta

unread,
Aug 20, 2014, 4:36:53 PM8/20/14
to seleniu...@googlegroups.com
Put up a small java code with try catch block and you should be good to go.
Message has been deleted

Priya P

unread,
Aug 20, 2014, 6:40:46 PM8/20/14
to seleniu...@googlegroups.com
Use the following:


   Alert myAlert = driver.switchTo().alert();    //swicths to the pop up window. Alert is a method. it returns of type alert which is a class of an object
     myAlert.accept();  //This will accept the alert
myAlert.dismiss(): //cancels the alerts

This is one method but there are other methods to such as switching windows etc.

Yuva

unread,
Aug 20, 2014, 10:32:34 PM8/20/14
to seleniu...@googlegroups.com
Thanks a lot for your reply Priya.

I need a Selenium RC command not Selenium2.0 command

Could you please provide Selenium RC command to resolve this issue

FYI,I already tried below Selenium RC commands

$sel->getAlert();
$sel->chooseOkOnNextConfirmation();
$sel->chooseCancelOnNextConfirmation();
$sel->answerOnNextPrompt();

Reply all
Reply to author
Forward
0 new messages