SUBSCRIBE HERE TO GET POST UPDATES VIA EMAIL :

Delivered by FeedBurner

Selenium IDE - "runScript" Command example to generate alert including variable value

In my previous post, I described how to generate alert message using "runScript" command in selenium IDE. In this example, Let we see how can we show variable value inside alert using "runScript" command. Copy paste bellow given example in your selenium IDE and run it.

Example 2 : "runScript" Command With Variable In Script

New Test
CommandTargetValue
openhttp://only-testing-blog.blogspot.in/2013/09/testing.html
addSelectionname=FromLBlabel=Russia
clickcss=input[type="button"]
storeTablecss=table.0.2lblname
runScriptjavascript{alert("Selenium has moved label '" + storedVars['lblname'] + "' at right side.")}
storeAlertalert
echo${alert}

CLICK HERE to look at more real world examples of "runScript" command.

In above example,
"storeTable" command will store label name in to variable 'lblname' which is moved between list boxes.
"runScript" command will show you alert message including variable value.

You can view how to generate alert in selenium webdriver with example on THIS LINK.

Use selenium IDE and webdriver examples in your software application test cases to get them better.

No comments:

Post a Comment