Selenium RC

Selenium Remote Control provides a Selenium Server, which can automatically start/stop/control any supported browser. It works by using Selenium Core, a pure-HTML+JS library that performs automated tasks in JavaScript.

The Selenium Server communicates directly with the browser using AJAX (XmlHttpRequest). You can send commands directly to the Server using simple HTTP GET/POST requests; that means that you can use any programming language that can make HTTP requests to automate Selenium tests on the browser. To further ease this process, we provide wrapper objects for a number of mainstream programming languages (Java, .NET, Perl, Python, and Ruby).

Finally, the Selenium Server acts as a client-configured HTTP proxy, to stand in between the browser and your website. This allows a Selenium-enabled browser to run JavaScript on arbitrary websites.

The Selenium Server is great for testing complex AJAX-based web user interfaces under a Continuous Integration system. It is also an ideal solution for users of Selenium Core or Selenium IDE who want to write tests in a more expressive programming language than the Selenese HTML table format customarily used with Selenium Core.

To get Selenium RC to work with CruiseControl:

1.  Download Selenium RC from
2.  Unzip the archive
3.  Copy selenium-server.jar to /usr/local/bin
4.  Create a custom firefox profile:
    firefox -ProfileManager
5.  Use Selenium IDE to record a test and save as .html
6.  Using a text editor, create a test suite which is a simple table with one column.
7.  java -jar /usr/local/bin/selenium-server.jar -firefoxProfileTemplate /home/khai/selenium -htmlSuite "*chrome" 
"" "/home/khai/selenium/applicationBasicAcceptanceTest.html" "/home/khai/selenium/result.html"

Here is a sample file for step 6:
This works:

java -jar c:\selenium-server\selenium-server.jar -firefoxProfileTemplate c:\firefoxProfiles\profile1 
-multiWindow -htmlSuite "*chrome" "" 
c:\selenium-tests\applicationBasicAcceptanceTest.html c:\selenium-tests\result.html

How to import certificate into java keystore:

1.  Download genius ca to c:\ca.cer
2.  Import genius ca into IE (Tools -> Internet Options)
3.  Export genius ca as c:\ca2.cer
"c:\Program Files\Java\jdk1.6.0_03\jre\bin\keytool.exe" -import -alias genius-selenium -keystore "c:\Program Files\Java\jre1.6.0_03\lib\security\genius-selenium" -file ca2.cer

The above command require a password. How to make it so that it does not require a password?
Debug trusted CA issue:

java VerifyHttps > hey

After we succeed at importing * as trusted certificate in java trust store, we intentionally specify wrong password for the trust store, firefox treat login.php as a downloadable file (it gives a dialog asking me if I want to save login.php as file). Here is the content of this file:

<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
Reason: You're speaking plain HTTP to an SSL-enabled server port.<br />
Instead use the HTTPS scheme to access this URL, please.<br />
<blockquote>Hint: <a href=""><b></b></a></blockquote></p>

Clearly something is wrong. I added to the command and redirect the output to a file. Firefox / SeleniumRC slowed way down. The output file is too larged to be opened completely with 'edit'. 'edit' only allow us to look at the first 65000 bytes, and there may be indication that other files were fetched successfully. And we still hit the same problem with login.php

This seems to work with minor exceptions:

java -jar c:\selenium-server\selenium-server.jar -firefoxProfileTemplate c:\firefoxProfiles\profile1 -avoidProxy -proxyInjectionMode -htmlSuite "*pifirefox" "" c:\selenium-tests\applicationBasicAcceptanceTest.html c:\selenium-tests\result.html -browserSessionReuse

These exceptions are:

1.  It is still using TestRunner in a frame.
2.  -browserSessionReuse doesn't seems to do anything.  Its position in the command also seems to be an issue (if you put it anywhere else, it barf).  I want firefox to not be teared down.

Interesting. I remove from the above command, and it behave the same. Thought that -browserSessionReuse has something to do with it. Remove -browserSessionReuse, and it still do the same. It should fail with "Could not proxy https" error.

Rename jssecacerts to something else, and the "Could not proxy https" problem happens again. Rename jssecacerts back, and thing works fine again. What a bloody pain. All these problems probably lie in the code of Jetty (the part do handle HTTPS request with origin server). We should take a look at Jetty code, and how it is embedded into selenium remote control.

Limitation of Selenium RC:

  1. Can't handle all modal dialog windows
  2. Can't handle file upload
  3. Can't handle file download

For firefox, user can create a user profiles, and specify a profile for a particular test, therefore, multiple tests can run concurrently on the same machine. For IE, Selenium RC modify registry settings and configures the LAN connection settings directly, therefore only a single test can be run on a single machine.

  1. chrome
  2. iehta
  3. iexplore

Complex tests that work in *chrome are not immediately useable on *iehta
Buildix is a distribution that contains subverstion, trac, cruisecontrol.

Google's framework for selenium: Wringle
Wringle piggy back on firebug to generate the UI map.

UI map Data map

There is an option -avoidProxy (didn't work) Pass…… option for the keystore (perhaps java…

When using *firefox, it SocketListener on, launch firefox, check resource aliases, SocketListener on Why two SocketListener ?

I am going to assume that your cert is a CA root cert, not a personal cert. THere is a difference: A CA root cert has only a public key. A personal cert has both a private key and a public key.

Go to Internet Explorer and

Tools Internet Options Contents Certificate Import

and import your *.pkcs12 certificate.

Now see where it ends up in the tabs: "Trusted Root" or "Personal".

From that same box, then select that certificate to set the focus and export it into an X.509 format (either binary DER or ascii Base64, keytool will figure it out). Then decide on an alias for the cert and import it. If you like, you can then delete it from IE.

keytool -import -alias joe -keystore %JAVA_HOME%\jre\lib\security\cacerts -file joe_certfile.cer

The default is to create a file called $HOME/.keystore . You might want to test it there before touching your cacerts. You might want to make an extra copy of cacerts, in case you mess it up. The password on cacerts is blank (just hit return).

There is more docs at,r=1.1/glassfish/admin-gui-ee/admin/src/java/com/sun/enterprise/ee/tools/admingui/docroot/help/ablqz.html

"c:\Program Files\Java\jdk1.6.0_03\bin\javac.exe" java VerifyTrustStore

After we succeed at importing * as trusted certificate in java trust store, we intentionally specify wrong password for the trust store, firefox treat login.php as a downloadable file (it gives a dialog asking me if I want to save login.php as file). Here is the content of this file:

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License