Pages

Friday, April 29, 2011

Selenium IDE tutorial - Part 1(Basic)


Selenium IDE is an integrated development environment for performing Selenium tests.
Selenium tests can be written as HTML tables or coded in various languages like PHP, C#, Perl , Python and can be run directly on browsers.
The IDE can help you to record, edit and dubug tests. Currently Selenium IDE is only available for Firefox as a add on.
Here is possible scenario for using Selenium. Imagine you have created a HTML form with about 15-20 fields and you have to repeatedly test the form.
Filling the form everytime can quickly become tedious.Using selenium you can automate the whole process and run the test as you wish.
In this part we will see how to create a simple test using Selenium.Lets start.

Step 1:Installation
Download Selenium Ide from here.
http://selenium-ide.openqa.org/download.jsp
https://addons.mozilla.org/en-US/firefox/addon/2079
Once Add-on installed Restart firefox

Step2:Running a simple test
1) Start Selenium IDE in firefox: Tools-> Selenium IDE.
You will see a pop up as below:

2)Click on red record button on the top right.
3)Brwse to Google.com and enter 'selenium' in the search box and press enter.
4)Click on the first result,which is of selenium.openqa.org
5)Stop the recording by clicking on the record button again.

You will see something like below. If you click on "source" tab you se the test html generated by selenium


The 'table' tab shows the commands recorded by selenium

6)Open a new tab in firefox and click on Selenium IDE's play button to run the recorded tests.


The IDE should play your recorded test.After the test complete you should have landed on the selenium page(http://selenium.openqa.org)
The IDE after the test run shown below.In the Log section you can see various events run by the test.In this table you will see all the rows in green, which means test ran successfully.


Now lets add a small assertion to the above test.

1)Click on the blank line below after the last ‘clickAndWait’ command and insert ‘assertTextPresent’ command from the drop down box as shown below.
You will see something like this.


This test checks to see if the text ‘Selenium News’ is present in the last rendered page.
Run the test again and you should see that the test has run successfully.
Now try replacing the text with something that is not present on the page, e.g ‘elvis’ and run the test again.
Now the test fails and you should get the screen below


You have just completed your first test run. And it was so simple

Cheers!!!



Here I have given just basic of Selenium IDE.If you required anything just comment here.
Based on that I will write my blog.


Keywords

Selenium ide|selenium rc|selenium tutorial|selenium grid|selenium tutorial|selenium tutorial pdf|selenium tutorial ppt|selenium tutorial for beginner|selenium tutorial downloadsoftware testing selenium|software testing selenium automation|software testing selenium ide|software testing selenium training|software testing selenium tool|automation tool