1
votes

I have scripts recorded through IDE and added while loop. It is working fine with IDE. When I try to run through Selenium RC, the browser opens and nothing happen. I have downloaded user-extensions.js from net and kept where the RC jar is.

Command to run: java -jar selenium-server.jar -userExtensions user-extensions.js -htmlSuite "*firefox" "https://dev.go.aboutone.com/" "C:\Scripts\test_suite.html" "C:\Scripts\results.html"

2

2 Answers

1
votes

I have an answer. It is probably not the official, recommended method ... however, I could never get the recommended method to work and am not a developer. Instead, of course, I hacked it ... and its been working ever since and is easy enough to redo in the event you update your jar file.

I copied an article I found on the internet (cant remember where now) to my own documents, and modified the instructions some. Here is what you can do (not what you should do):


I had trouble using the -userExtensions parameter in my RC batch file for including user-extensions. I also had trouble processing the instructions in the selenium documentation (found here: http://www.seleniumhq.org/docs/08_user_extensions.jsp#using-user-extensions-with-selenium-rc).

Instead of all the developer jargon, I simply cracked open the selenium-server-standalone-2.25.0.jar file using WinZip, and followed these instructions-

1. Open the selenium-server-standalone-2.25.0.jar file using winzip an extracted the “user-extensions” file only to your C drive. So now you have the user-extansions.js in your C:\core\scripts folder.

2. Edit the user-extensions.js by adding your extensions, just like you do with the IDE.

3. Using Winzip again, add the modified user-extensions.js to the selenium-server.jar. For this:

a. Open selenium-server.jar using Winzip.

b. Use the “Add” button on the top bar of Winzip

c. 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.

4. Close Winzip

Now the new selenium-server.jar is ready with your own user-extensions. No custom processor calls or instantiation needed.

Note, that some IDE user extensions do not work, without modification, with RC. In many cases, the developer usually provided a version for the IDE and a version for RC. If that is the case for the extension you are adding, make sure to copy in the right extension from the correct source.


Hope this helps.

0
votes

It is working for me, if I use the full path to the user-extensions.js file:

java -jar selenium-server-standalone-2.53.1.jar -userExtensions "C:\selenium\cardTests\flowControlIDEExtension\user-extensions.js" -htmlSuite "*googlechrome" "http://localhost:12345" "c:\selenium\cardTests\klondikeTestSuite.html" "c:\selenium\cardTests\klondikeTestSuiteChromeOutput.html"