Selenium

Selenium is an easy-to-use and popular open source web applications Test Automation tool.  Now a days’ lot of enterprises and ISVs (Independent Software Vendors) are looking out for open source tools. Open source communities are strong and getting support is also easier than for the licensed tools.  Best example for this is LAMP (Linux, Apache, MySQL, PHP) which is used for web development and Selenium, used for test automation.

Selenium provides lot of features for test automation such as easy recording and play back of tests using Selenium IDE.  Selenium supports multiple platforms, browsers, and programming languages.  Especially, supporting multiple programming languages such as C#, Java, Ruby, Python, PHP, Groovy, etc is really fascinating.

This blog explains test automation with Selenium from the scratch in a tutorial manner.  Even if a tester who does not have any prior automation testing experience can also start learning Selenium by going through the various posts in this blog.  Blog posts cover lot of topics such as Recording tests with Selenium IDE, setting up Selenium with Eclipse, learning Java concepts and programming, understanding Selenese methods, writing data driven tests with MS excel, CSV, XML, etc.  These topics are explained in a manner that will help the readers to understand the Selenium easily.

Below is an Index of Topics covered in the blog on Selenium:

Selenium Basics:

  1. What is Selenium?
  2. How Selenium identifies the objects?
  3. Write XPath to identify the objects
  4. Record tests using Selenium IDE
  5. Sample application to learn Test Automation – Sugar CRM (an open-source CRM application )
  6. Learn Selenium Step-by-Step
  7. Reading these articles together (one by one) is highly suggested to understand recording and running of Selenium Tests (sample application used in all these posts)
    1. Recording Tests with Selenium
    2. Export Tests into Java / JUnit and run in Eclipse
    3. Execute the tests with JUnit 4
  8. Assertions for verifying test output

Selenium and JUnit:

  1. Setting up Selenium with Eclipse
  2. Introduction to JUnit 4 annotations
  3. JUnit 4 annotations – Before vs BeforeClass
  4. How to write Selenium tests with JUnit

Parameterization Techniques:

  1. Parameterization with MS Excel
  2. Parameterization with CSV file
  3. Parameterize tests in Selenium IDE

Properties, Logs, and Reports:

  1. Parameterize global settings using properties files.
  2. Create Logs for step-by-step analysis of test execution.
  3. Generate HTML reports / XML reports for detailed summary of test execution.

Test Automation Framework:

  1. What is Test Automation Framework
  2. What are the features of a framework
  3. Designing a framework for Test Automation

The above topics are covered in the various blog posts.

{ 14 comments… read them below or add one }

Rakesh December 27, 2011 at 9:59 am

Hi seetaram,

How to handle pop up window with RC (java). I have confirm button to which i am clicking as
selenium.click(“css=input[type=\"image\"]“);
After this an popup appears.
I want to click cancel on the confirmation dialog but it always click on OK and proceeded to next page. The confirmation dialog not flashes even. If doing manually it is coming up fine.

Used selenium.chooseCancelOnNextConfirmation() but still it immediately goes to next page and cancel the things.
So my query is how to handle these pop ups with RC
Thanks

Reply

seetaram January 2, 2012 at 7:27 am

use selenium.chooseCancelOnNextConfirmation() for Javascript popup. use Selenium IDE and record once. Check the code Selenium IDE generates and find out is it selenium.selectWindow. Then code accordingly…

Reply

SriRam January 13, 2012 at 10:47 am

there is no dynamic wait method in web driver like selenium.waitforPageToLoad(),

could you please provide solution for that.

Thanks,
Sriram.

Reply

Stavan May 16, 2012 at 5:46 pm

You can write your own method using while loop.
Example:

boolean status = true;
while(status){
if(driver.findElement(By.id()) != null){
status = false.
}
}

Reply

surya January 18, 2012 at 8:37 am

What is the syntax of XPATH,CSS,DOM ?(In Seleniuim)

Note: i got the Xpath but i am unable to find the CSS & DOM syntax in selenium. can you please explain for CSS & DOM.
please send it to my mail.

Reply

Vishal Aggarwal January 20, 2012 at 1:11 pm

Thanks Seetaram …!!! It’s one of the most comrehensive site on the internet on selenium, covering all important topics at one single place.

Reply

tester January 20, 2012 at 1:54 pm

Thank You for all your efforts

Reply

tester2 February 2, 2012 at 2:01 pm

Best site ever! Thanks a lot and keep up the good work!

Reply

Mini Chakiyar April 4, 2012 at 5:41 pm

Hi Seetharam,

Many Many thanks for the detailed information about selenium. its helping us a lot. I am looking for documentation on integrating CI server with selenium tool. Can you please share any info on this

Regards,
Mini

Reply

seetaram April 16, 2012 at 12:40 pm

I have not prepared any documentation as such.. I can provide you the steps to integrate with CI server such as Hudson…
1. Generate HTML reports through Ant
2. If the reports are JUnit reports Hudson has an inbuilt support for JUnit
3. Create a Job on Hudson and invoke the ant build file from Hudson job. Run the ant target from Hudson job
4. Configure the Hudson to display your test results. For this, there is an option on Hudson

Reply

priyanka April 10, 2012 at 5:22 am

excellent site !!!

I have created two java files ie
testscripts.tests.Login_version1
AddProcessingStep

And configured the xml file as shown below at default location.


Now Could you please explain how to run this test suite?

When i did right click on a specific java file , and run through test ng only that file will get executed.

Kindly have a look.

Thanks,
Priyanka

Reply

seetaram April 16, 2012 at 12:24 pm

need more clarification.. on what you are doing…I am not able to understand what xml you have created…

Reply

Murali Krishna May 18, 2012 at 10:56 am

Hi Seetharam,

Many thanks for details information provided for selenium in a simplest form.
But one thing to be rectified.
There is a mismatch between the name of the link and the launch page content.
for example the name of the link is “Export Tests into Java / JUnit and run in Eclipse” when i click this the link goes to the page “Selenium – Setting up Selenium & Eclipse”. here both are different pages.
kindly check and rectify these type of mistakes. sorry to pointing about this.

Reply

seetaram May 18, 2012 at 3:54 pm

Many thanks for showing me the issue… definitely will be rectified…

Reply

Leave a Comment

Do you want to get updates on the recent articles written? Please subscribe to RSS feed or Email