Reputation: 383
I'm very new to Selenium IDE. Please help if you can.
Here's my scenario: The website has a drop-down menu with 3 options. Let's say the options are: A, B and C. Selecting option A pops-up a alert message (that a user needs to affirm to by clicking the 'OK' button). Selecting the other two options, B and C does not show any alert messages.
When I recorded, selecting the option A (that shows the alert message), it recorded a step with 'assertAlert' in the script. Now, when I parameterzied the script so that it selects the other two options (B and C) for different iterations, it is failing at the 'assertAlert' (understandably, since there's no alert message to assert).
The question is: is there a way to ignore or avoid this? For example, is it possible execute this 'assertAlert' step when the input parameter is A for the drop-down menu and skip when it's either B or C?
I hope I made my question clear. Please provide answers with examples. Thanks in advance!
Below is the screenshot of the screen:
The data.js file that contains 'CompanyName' and 'positionMode' arrays:
Upvotes: 1
Views: 531
Reputation: 383
Ok, I found a solution. Please let me know if you have any better than this. Basically, I had to use 'gotoIf' command. The idea is pretty simple, I checked if the option is not the one that alerts, then skipped the 'assertAlert' statement by going to the 'skipAlert' label.
Pasting the solution after the update:
Thanks.
Upvotes: 1