I am novice to automation testing and have started using Selenium IDE as the choice for automation.
I just want to know if there is any way to handle java-script alerts using IDE.
Take a scenario: I am clicking on "Delete" button and there es a java-script alert box with OK and Cancel options, but Xpath can not identified for these elements.On the other hand, when I make a script for click event on delete button and run it using Selenium IDE, the element gets automatically deleted.
So, guys please help. Leave a reply in case my question needs to be elaborated.
Thanks in advance.
I am novice to automation testing and have started using Selenium IDE as the choice for automation.
I just want to know if there is any way to handle java-script alerts using IDE.
Take a scenario: I am clicking on "Delete" button and there es a java-script alert box with OK and Cancel options, but Xpath can not identified for these elements.On the other hand, when I make a script for click event on delete button and run it using Selenium IDE, the element gets automatically deleted.
So, guys please help. Leave a reply in case my question needs to be elaborated.
Thanks in advance.
Share Improve this question edited Feb 9, 2013 at 15:20 Ross Patterson 9,58935 silver badges50 bronze badges asked Feb 9, 2013 at 12:23 AbhiAbhi 1072 gold badges3 silver badges6 bronze badges2 Answers
Reset to default 2Take a look at the documentation. The main part is this:
When running under Selenium, JavaScript pop-ups will not appear. This is because the function calls are actually being overridden at runtime by Selenium’s own JavaScript. However, just because you cannot see the pop-up doesn’t mean you don’t have to deal with it. To handle a pop-up, you must call its
assertFoo(pattern)
function. If you fail to assert the presence of a pop-up your next mand will be blocked and you will get an error similar to the following[error] Error: There was an unexpected Confirmation! [Chose an option.]
A step-by-step manual is in the section about Alerts.
java-script alerts in ide can be handle using selenium mands storeAlert and
storeConfirmation what it will do is it Retrieves the message of a JavaScript confirmation or alert dialog generated during the previous action. this mands can be put at the position where the alert will occur
mand:storeAlert
Target:variableName
mand:storeConfirmation
Target:variableName
variable name is the variable in which the occurred alert will store
Thank you..