Selenium IDE - How to handle java-script notifications and confirmations

I'm new to test automation and started using the Selenium IDE as my choice for automation.

I just want to know if there is a way to handle java-script warnings using the IDE.

Take a script: I click the Delete button and a java-script alert box pops up with OK and Cancel options, but the Xpath cannot be identified for these items. On the other hand, when I make a script for a click event on the delete button and trigger it using the Selenium IDE, the element is automatically removed.

So guys please help. Leave an answer if my question needs to be clarified.

Thanks in advance.

+3


source to share


2 answers


Check out the documentation . Main part:

JavaScript pop-ups are not displayed when run under Selenium. This is because function calls are actually overridden at runtime by Seleniums native JavaScript. However, just because you can't see the popup doesn't mean you don't have to deal with it. You must call a function for processing assertFoo(pattern)

. If you do not approve the presence of the popup, your next command will be blocked and you will receive an error similar to the following

[error] Error: There was an unexpected Confirmation! [Chose an option.]

      



For a step-by-step guide, see the section on alerts.

+2


source


java-script warnings in ide can be handled with selenium commandsAlert and

storeConfirmation, what it will do is receive a JavaScript confirmation or warning dialog prompt generated during the previous action. these commands can be placed in the position where the warning will occur

Command: storeAlert

Target: nameVariable



Command: storeConfirmation

Target: nameVariable



variable name is the variable in which the generated warning will be found

Thank..

0


source







All Articles