Friday, 28 December 2012

"Failed to start: SocketListener0@" while Selenium RC Test Execution

Many of us face this common error while trying to execute tests after a successful test run. This is because of the Selenium server that starts on port 4444 and fail to shutdown, throwing an error message on forthcoming tests.

WARN - Failed to start: SocketListener0@

There are couple of alternate ways to overcome this

1| Open a new tab from your web browser.
2| Copy and paste the below URL.
3| Soon-after hitting Enter button, a get response 'okok' will be obtained; it make sure that the Selenium server is shutdown on port 4444.

4| Now, its time to re-run your test on port 4444.

1| Open cmd
2| Force Selenium server to listen port other other than 4444. i.e., 5555 or other
java -jar selenium-server-standalone-x.xx.x.jar -p 5555

Handling browser-level authentication | Selenium

Whenever a site prompts for an username and password, make use of the following script to override such authentication,


e.g., driver.get("");

Thursday, 27 December 2012

Maven | Selenium Test Execution

Text in ORANGE has to be edited by users or mentioned important through-out this BLOG

Maven is the Central Repository [like a server], where it can store the jar files. Here, we use Maven as a test execution framework.

Set Maven Environment

1| Download Maven
2| Unzip the folder under C:\Program Files\
3| Create a new System Variable under 'Environment Variables'.
Variable: M2_HOME
Value: C:\Program Files\apache-maven-3.0.4

4| Add Maven path under the variable name, 'Path'
Variable value: %M2_HOME%\bin

5| Make sure that maven is configured properly.
6| Open cmd prompt.
7|Type 'mvn -version'

Configure Maven on Eclipse

1| Install Maven plugin in Eclipse IDE using "Eclipse Marketplace.."
2| Create a new 'Maven project' in Eclipse IDE.
Right click on Package Explorer > New > Other
3| Type 'maven' and Click Next.

4| Select the Project location and Click Next.
5| Select an Archetype as shown below and Click Next.

6| Enter the 'Group Id' and 'Artifact Id' and Click Finish.

7| Now, you will see a POM file created below target folder.

Modify POM.xml

1| Create a new class file under src/test/java; Here it is ''
2| Open the POM xml file.
3| Add the following dependencies for a simple test execution.
JUnit, TestNG, selenium-server, selenium-java

This is how the POM looks like,

<project xmlns="" xmlns:xsi=""








4| The build libraries mentioned under dependencies will automatically added into the project soon-after saving the POM.xml

Maven Test Execution

There are couple of ways to execute Maven Test.

1| In eclipse, right click on the POM.xml > Run As > Maven install

2| In-order to clean existing test results, it is important to 'Maven clean' before executing a new test.
right click on the POM.xml > Run As > Maven clean

1| Open cmd prompt.
2| Move into the project folder.
3| Type 'mvn clean'
4| Type 'mvn install' for test execution

Note| If you've trouble on creating Maven projects using maven-archetype-quickstart [Eclipse],
1| Open cmd prompt
2| Locate the workspace
3| Enter the below to create a maven project
mvn archetype:generate -DgroupId=yourgroupid -DartifactId=yourartifactid -DarchetypeArtifactId=maven-archetype-quickstart