variables in selenium IDE - RC

1,003 views
Skip to first unread message

KobyliskyByk

unread,
Dec 8, 2010, 9:55:00 AM12/8/10
to Selenium Users
Hi,
I am using Selenium IDE test suite for my automation. For diferent
reasons i am using variables. Many variables are defined in one use
case and used in diferent use case, so i can use this module like
behavior. When i play test in selenium IDE, there is really no trouble
with that. All variables are considered global ... but when i try to
lunch same script using selenium RC it fails at the time the script
gets to use fist variable (definion of variable is ok). I am not sure
but i think, that RC considers variables as local to the test case.

Anyone can help me ?

James Johnson

unread,
Dec 9, 2010, 12:17:12 PM12/9/10
to Selenium Users
Greetings,

I have been successfully using variables across my entire test suite.
This works in both Selenium IDE and RC.

Here is how:
I setup the user-extension.js for all my global parameters.
Specifically, put all the values into the storedVars array.
storedVars["url"] = "http://www.google.com";

If, I want the parameters to run in RC, I need to wrap these
declarations within a function.
I call that function ingredients.
Then, the first line of each test, I run the command to call my
function.
Now, all the parameters are loaded for run time.


James Johnson

David De La Harpe Golden

unread,
Dec 9, 2010, 12:38:30 PM12/9/10
to seleniu...@googlegroups.com, KobyliskyByk
On 08/12/10 14:55, KobyliskyByk wrote:
> Hi,
> I am using Selenium IDE test suite for my automation. For diferent
> reasons i am using variables. Many variables are defined in one use
> case and used in diferent use case,

> Anyone can help me ?

The global store extension gets around this.

http://wiki.openqa.org/display/SEL/global

Kam Hor

unread,
Oct 15, 2012, 11:41:22 AM10/15/12
to seleniu...@googlegroups.com
Hi,
      May I ask you a question about this?    When I run my test in RC,  I will get the following error "Unknown command: loadParameters"   which loadParameters is my user-extensioins.js function.  May I ask is my doLoadParameters function correct?

for example
user-extensions.js
================
Selenium.prototype.doLoadParameters = function()
{
storedVars["Login_url"] = "http://mail.abcefg.com";
storedVars["Login_Email"] = "Tes...@test.com";
storedVars["Login_Password"] = "TestPW";

retrun 0;
};   

Run RC command
=============
c:\SeleniumServer>java -jar c:\seleniumserver\selenium-server-standalone-2.25.0.jar -userExtensions c:\seleniumserver\user-exten
sions.js -htmlsuite *firefox http://mail.abcefg.com C:\SeleniumServer\SeleniumIDE_Test_Suite_1.html C:\SeleniumServer\Scheduledresult.html

RC log
=====
info: Executing: |loadParameters |  |  |
error: Unknown command: 'loadParameters'
warn: currentTest.recordFailure: Unknown command: 'loadParameters'

Thank you for any help

Kam

huong nguyen

unread,
Jul 15, 2013, 10:44:16 PM7/15/13
to seleniu...@googlegroups.com
Hi
I followed (Mr/Ms) Asha's suggestion in the following forum and it worked for me.
Hope this help for you
Rgds

https://groups.google.com/forum/#!topic/selenium-users/rhLk11Ksy-I

---
If you can  rebuild selenium-server.jar with the your new user-extensions.js, it will recognize your custom functions.
I did this using Winzip. The steps followed are:

1) Downloaded the selenium-server.jar
2) Opened it using winzip and extracted the "user-extensions" file alone in it to my C drive. So now I have the user-extansions.js in my C:\core\scripts folder.
3) Edited user-extensions.js by adding some custom methods that I needed.
4) Now using Winzip again, added this modified user-extensions.js to the selenium-server.jar. For this,
-- Open selenium-server.jar using Winzip.
-- Use the "Add" button on the top bar of  Winzip
-- In the "Add" window, browse to C:\core\scripts\user-
extensions.js file
-- Make sure that the "Actions" choosen is "Add (and replace) Files" and "Save full path info" is checked in the "Folders" option.
-- This will replace the user-extensions.js in the selenium-server.jar with our modified user-extensions.js with same path information.
-- Close Winzip
5 ) Now the new selenium-server.jar is ready with your own user-extensions.
6) You can execute with usual RC syntax:

path/to/java -jar name-of-selenium-rc-jar -htmlSuite <browser> <startURL> <suiteFile> <resultFile>

I could do this successfully in my test environment and the version of Winzip I am using is Winzip 8.1

Regards,
Asha.
---

Vào 22:41:23 UTC+7 Thứ hai, ngày 15 tháng mười năm 2012, Kam Hor đã viết:
Reply all
Reply to author
Forward
0 new messages