Common Issues and Solutions in Selenium

Selenium is fast becoming one of the most widely used test automation tools for web based applications. While working on selenium projects we faced some common issues that I thought is best addressed through the solutions I am listing below. In case you have tried other solutions and they have worked for you, please feel free to add your inputs in the comments box.

Issue No. 1. Issue in handling popup windows / Frame
Solution: Pop-ups that are very commonly found on the GUI of web apps are many times not recorded by selenium or cause issues while running selenium scripts. The table below gives a snapshot at how these issues can be handled

Popup Type Description Solution
Alert Popup (Message box) Message box popup on application To handle alert popup you can use getAlert functions e.g. selenium.GetAlert();
This will click on Ok button of alert and return alert message.
Confirmation Popup This type of popup has Ok & Cancel buttons You can select the button you want to click, by using below statements before GetConfirmation
For Ok – chooseOkOnNextConfirmation
For Cancel – chooseCancelOnNextConfirmation
And then use GetConfirmation as follows,
This will click on selected button & return confirmation message.
Popup Window/ Frame In this type of popup, the Frame/window contains data fields where we have to fill values in fields. this can be done using SelectFrame
Following code will illustrate how this can be done.

// This will open a popup window asking user to enter activation code & click on confirm button
selenium.SelectFrame(frmActivationCode); // this will transfer the control to Activation code frame i.e. popup window
//Now you can process objects from popup frame
selenium.Type(txtactivationCode, stractivecode);
// After this you have to get back the control to parent window again using

Issue No.2. Selenium does not trigger event on changing values
Solution: Selenium does not trigger event on changing values so we have to explicitly trigger the event using fireEvent,

selenium.FireEvent(cmbCategory, “onchange”);
Here, cmbCategory is object on which you want to fire event & onchange is the name of event.

Issue No.3. Synchronization issue leading to timeout
For this type of scenario I created a function ‘CheckElementPresent’ which will take object locator as parameter & will return true once object is visible.

Here, I have used selenium.IsElementPresent(locator) to verify object is present in for loop with Thread.Sleep

Issue No.4. Handling SSL certificates
Solution: Many times we face issue in SSL certificates for selenium tests. We can handle this issue by using –trustAllSSLCertificates & firefox profiles as shown below,
a. For browser other than firefox
Use following command to start selenium server, this will start selenium server which trust all SSL certificates.
C: > java -jar c:\Selenium\selenium-server2.14.0.jar. –trustAllSSLCertificates
b. For Firefox browser
Create a new firefox profile (steps to create profile –
And accept SSL Certificate using same profile. Now, use the same profile while running selenium server using following command,

C:> java -jar c:\Selenium\selenium-server2.14.0.jar. -firefoxProfileTemplate /C:\Selenium\ Profile

Here were some issues that I faced and the solutions I came up with. Please share any other solutions you know of for the above issues. Also please share other issues that you faced and if possible provide the solutions that you came up with. Happy testing! 

Hemant Jadhav | Senior Consultant | ZenTest Labs

Implementing Object Repository in Selenium

Selenium ( has now emerged as one of the top contenders to take on QTP in the test automation tools space. Our teams at Zen Test Labs ( were one of the early adopters of this automation tool and have built up a decent level of expertise in automating test scripts using selenium. We recently also presented a tutorial on this topic at STARWEST, California in October 2011.

While both tools have their advantages and disadvantages, object repositories are one area that I have found to be important but not supported by Selenium. An object repository is a centralized place for storing properties of objects available in the application under test (AUT) to be used in scripts. QTP comes with its own object repository where one can record and store objects.

Over the course of a recent project I have tried to implement object repository in and it worked really well. I am listing below, how I went about doing this.

1. Create an interface of a name you want to give to your object repository as follows,
Interface ObjectRepository
// Now here you can store properties of the object in variable
Static String ddCategory = “id=ctl00_MainContent_ddlCategory”;
Static String btnSave = “”id=ctl00_MainContent_btnSave””;

2. Implement the interface into your class and you are good to use objects in your functions
Class TestLibrary implements ObjectRepository
public String testFuntion()
//here you can your object to perform actions or validations, “Testing”);
if (selenium.isElementPresent(btnSave);

In the above example, I have implemented it in java and have also tried it in C#. Thus, using OOPS concepts I feel that this can be implemented in any object oriented language supported by Selenium.
What is important to note is that one can also connect to excel or any database and store values. Thus in the event of changes in the application or changes in properties of any object; a simple change in the excel file or DB will reflect across all instances of the object.

Some of the advantages of doing this include:

1. Easily maintain your tests or components when an object in your application changes
2. Manage all the objects for a suite of tests or components in one central location
3. Code becomes more readable & easy to write when user defined objects name are used instead of complex and long property name & value.

These have been some of the approaches that have worked for me and my learning’s. Would be great to get to know other people’s experiences in implementing object repositories within Selenium

Hemant Jadhav | Senior Consultant | ZenTest Labs