Setting up Selenium for recording as well as running in different browsers and platforms

Tom picture Tom · Jun 7, 2011 · Viewed 23k times · Source

I'd like to setup a Selenium server so that clients can record tests locally, recorded tests can be replayed and tested on an Ubuntu server with Firefox + Chrome.

Unfortunately the Selenium site is so confusing and mentions so many different projects (Selenium 1, Selenium 2, Selenium RC, Selenium Grid) that I'm not sure where to start.

How do I go about setting up Selenium Server on an Ubuntu box?

Answer

A.J picture A.J · Jun 7, 2011

Unfortunately the Selenium site is so confusing and mentions so many different projects (Selenium 1, Selenium 2, Selenium RC, Selenium Grid) that I'm not sure where to start.

Selenium has multiple versions

  1. IDE - mainly to record the test and play it back. It is mainly a Firefox Addon. This can be used for very basic testing. You can also export the recorded test to selenium RC. All these mentioned in seleniumhq.org->documentation section: http://docs.seleniumhq.org/docs/

  2. RC - Like any other automation tool, you can write your own code to run the test rather than just recording and playing it back. This has far better capabilities than IDE including support for several languages (Java, Javascript, Ruby, PHP, Python, Perl and C#) and support for almost every browser out there in various platform.

  3. Grid - This helps in running multiple tests in parallel.

To record and run the test in Firefox (NOT CHROME) its very easy. This doesn't require a selenium server running.

  1. record the whole test

  2. save it in a file

  3. Copy the file to Ubuntu machine

  4. Open the same test using IDE in Ubuntu machine and run it again in firefox

If you want to run on chrome, then you need to go to the next level of using selenium RC. And this requires the selenium server running.

How do I go about setting up Selenium Server on an Ubuntu box

Download selenium-server jar from here. Copy this to any directory in your ubuntu server

Open a terminal and navigate to the folder which has the selenium server jar.

Enter java -jar selenium-server-jarfilename.jar

Selenium server will start on port 4444 by default and keep listening to the tests.