Archive for the ‘Selenium Tools’ Category

Selenium server Arguments.

July 4, 2011 2 comments

Following are the arguments we can use while starting Selenium Server. If we use these arguments properly we can reduce the amount of time spent for finding a solution for complex scenarios.

port <nnnn>: the port number the selenium server should use
(default 4444)

timeout <nnnn>: an integer number of seconds before we should give up

interactive: puts you into interactive mode.  See the tutorial for more details

singleWindow: puts you into a mode where the test web site executes in a frame. This mode should only be selected if the application under test does not use frames.

profilesLocation: Specifies the directory that holds the profiles that java clients can use to start up selenium.  Currently  supported for Firefox only.

forcedBrowserMode <browser>: sets the browser mode to a single  argument (e.g. “*iexplore”) for all sessions, no matter what is passed to getNewBrowserSession

forcedBrowserModeRestOfLine <browser>: sets the browser mode to all the remaining tokens on the line (e.g. “*custom /some/random/place/iexplore.exe”) for all sessions, no matter what is passed to getNewBrowserSession

userExtensions <file>: indicates a JavaScript file that will be loaded into selenium

browserSessionReuse: stops re-initialization and spawning of the browser between tests

avoidProxy: By default, we proxy every browser request; set this flag to make the browser use our proxy only for URLs containing ‘/selenium-server’

firefoxProfileTemplate <dir>: normally, we generate a fresh empty Firefox profile every time we launch.  You can specify a director to make us copy your profile directory instead.

debug: puts you into debug mode, with more trace information anddiagnostics on the console

browserSideLog: enables logging on the browser side; logging messages will be transmitted to the server.  This can affect performance.

ensureCleanSession: If the browser does not have user profiles, make sure every new session has no artifacts from previous  sessions.  For example, enabling this option will cause all user cookies to be archived before launching IE, and restored after IE is closed.

trustAllSSLCertificates: Forces the Selenium proxy to trust all  SSL certificates.  This doesn’t work in browsers that don’t use the  Selenium proxy.

log <logFileName>: writes lots of debug information out to a log  file

htmlSuite <browser> <startURL> <suiteFile> <resultFile>: Run a single HTML Selenese (Selenium Core) suite and then exit immediately, using the specified browser (e.g. “*firefox”) on the specified URL (e.g. “;).  You need to specify the absolute path to the HTML test suite as well as the path to the HTML results file we’ll generate.

proxyInjectionMode: puts you into proxy injection mode, a mode  where the selenium server acts as a proxy server for all content going to the test application.  Under this mode, multiple domains can be visited, and the following additional flags are supported:

dontInjectRegex <regex>: an optional regular expression that proxy injection mode can use to know when to bypss injection

userJsInjection <file>: specifies a JavaScript file which will then be injected into all pages

userContentTransformation <regex> <replacement>: a regular  expression which is matched against all test HTML content; the  second is a string which will replace matches.  These flags can be used any number of times.  A simple example of how this could be useful: if you add “-userContentTransformation https http” then all “https” strings in the HTML of the test application will be changed to be “http”.

SetUp method for Selenium RC.

June 29, 2011 1 comment

We can write setup method for Selenium RC in different ways.

1. Initialize the selenium server for test classes after starting the selenium server manually.

2. Initialize and Start selenium server from the code itself.

If we use TestNG framework we can write this setup method as BeforeClass.

Sample code for first method

    public void testsetUp() throws Exception
        selenium = new DefaultSelenium(“localhost”, 4444, “*firefox”, BaseUrl);

Sample code for second method


public void SetUp(String url, String browser) throws Exception
         SeleniumServer seleniumserver = new SeleniumServer();
        setUp(url, browser);“/”);

Basic Selenium Intro..

February 10, 2011 5 comments


Now a days ‘Selenium’ is common and popular world in software testing field.  Selenium is package of web application testing tools developed by thoughtworks. Popular tools in the Selenium package are

  • Selenium IDE
  • Selenium RC
  • Selenium Grid
  • Selenium 2 and WebDriver

Selenium IDE

I think, it is most popular tool in the selenium package because of its ease of use. Its an Firefox addon. We can easily installed as Firefox plug in on and record and playback web applications. Most importantly there is no need for technical background for using Selenium IDE.

For more info

Selenium RC

If the application under test is some what complex, Selenium RC comes into play. Because we can not do complex logics in Selenium IDE. Main thing regarding the Selenium RC is that we can create our test scripts in any language[java, php, c#, ruby, python etc] and run it on any java script enabled browsers [fire fox, Internet Explorer, Safari, Google Chrome]

For more details

Selenium Grid

Consider a test application that have hundreds of tests to run for every regression[or every day], how can we manage since running those many scripts in Selenium RC takes hours and hours to execute. To over come this situation Selenium Grid is the option. Selenium Grid executes the tests parallel and saves lot of time. And also we can run tests in multiple machines and browsers at same time.

For more details

Selenium 2 and WebDriver

This is developed to overcome some limitations of Selenium 1[RC]. It does not depend on a javascript core embedded within the browser, therefore it is able to avoid some long-running Selenium limitations. Developers proposed this tool for using following conditions :

  • Cross domain testing
  • Handling multiple frames, multiple browser windows, popups, and alerts.
  • Drag-and-drop.
  • AJAX-based UI elements.

In addition to above listed tools, there are some other tools also coming from Selenium family

  • Selenium Core
  • Selenium on Rails
  • Selenium on Ruby
  • Cubic Test
  • Bromine


%d bloggers like this: