Friday, November 26, 2010

Implementing IF..ELSE.. condition in Selenium IDE using Flow Control Add-On

Here I am going to discuss about on how to implement if else condition in selenium IDE.We can't implement the IF ELSE condition using core selenium IDE. To implement IF ELSE logic, you have to install Firefox "Flow Control" Add On. So, please install the "Flow Control" Add On using below URL.

https://addons.mozilla.org/en-US/firefox/addon/85794/

After installed, restart the firefox browser. Now, Flow Control commands available in the selenium IDE.

Here are the commands:

COMMAND| TARGET |VALUE
======================================================
gotoif| CONDITION |LABELNAME
label | LABELNAME|
gotolabel | LABELNAME

Here is the example that i have used:



From the above screenshot, first i am checking whether text("Please select") present in the page using "storeTextPresent" and assign the result to variable "POPUP_EXISTS". Then i am checking whether result is "false" or not. if the result is "false", then skip the next statement and move the execution to "target1"(label). Otherwise, continue the execution to next statement.

No comments: