Tutorial For Selenium IDE "getEval" Command To Get Alert During Script Execution

There are many advanced selenium IDE tutorial posts available about different commands, methods and selenium IDE plugins and i think that all of them will help you to make your software testing process easy using selenium IDE. Now let me tell you one more interesting and most useful command to include in your
main commands directory list and i hope it will helps you.

"getEval" Command
In Selenium IDE, "getEval" command is useful to run javascript snippet when command get executed. Run bellow script in your selenium IDE and see what happens. "gotoIf" and "gotoLabel" commands will be supported in selenium IDE only if you have attached user extension with selenium IDE. Click here to read more about "gotoIf" and "gotoLabel" commands.

New Test
CommandTargetValue
storeString MessageStr1
echo${Str1}
storeString MessageStr2
echo${Str2}
gotoIfstoredVars['Str1']==storedVars['Str2']Check2ndStr
getEvalalert("Sorry, Str1 does Not Match with Str2..")
gotoLabel2ndStrCheck
labelCheck2ndStr
getEvalalert("Both Strings are Same :)")
label2ndStrCheck
storeMessage StringStr2
echo${Str2}
gotoIfstoredVars['Str1']==storedVars['Str2']correct
getEvalalert("Sorry, Str1 does Not Match with Str2..")
gotoLabelfinish
labelcorrect
getEvalalert("OK.. Now Both Strings are Same :)")
labelfinish

I hope you are already aware about all other commands except "getEval" command. So let me describe here just "getEval" command. In above script, when "getEval" command executed, it will generate alert message with string written in target column and selenium will stop execution. Once you click on 'OK' button of alert message, once again selenium IDE will start next command execution. This way, You can put alert message in between selenium IDE script to get alert during software testing using selenium IDE. You can use "getEval" command for data driven testing using selenium IDE.

No comments:

Post a Comment