Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
Advisor
Advisor
------------------------
------------------------
Posts : 387
Join date : 2009-07-30
Location : India
https://seleniumforum.forumotion.net

How to use runScript() in Selenium RC? Empty How to use runScript() in Selenium RC?

Tue Aug 25, 2009 6:41 pm
hi,

For executing the javascript snippet in selenium rc is simple by the use of single command:

storeEval ( script, variableName )

Gets the result of evaluating the specified JavaScript snippet. The snippet may have multiple lines, but only the result of the last line will be returned.

Note that, by default, the snippet will run in the context of the "selenium" object itself, so this will refer to the Selenium object, and window will refer to the top-level runner test window, not the window of your application.

If you need a reference to the window of your application, you can refer to this.browserbot.getCurrentWindow() and if you need to use a locator to refer to a single element in your application page, you can use this.page().findElement("foo") where "foo" is your locator.

Arguments:

* script - the JavaScript snippet to run
* variableName - the name of a variable in which the result is to be stored.

Returns:
the results of evaluating the snippet


Example of it:

selenium.getEval(javascript{alert('Thanks... I feel much better now!');}); // for rc

runScript | javascript{alert('Thanks... I feel much better now!');} // for IDE

You can use any code of javscript which has no error and suceesfuly complied. Make sure of this, otherwise snippet will give error.

I hope this will help you. Best Of Luck.

Bye
Back to top
Permissions in this forum:
You cannot reply to topics in this forum