Google+

13. What is Selenium IDE ?





The following are the four Selenium Automation tools -

1) Selenium IDE
2) Selenium RC
3) Selenium WebDriver
4) Selenium Grid

Selenium IDE is a firefox extension which is used to record the tests like recording a video and playback the recorded tests like playing a video.

Using Selenium IDE we can create Selenium Automation Code without writing the code instead the code gets generated automatically when we record the tests using Selenium IDE. Where as with Selenium RC and Selenium WebDriver tools we need to write the code ourselves.

We use Selenium RC and Selenium WebDriver to write automation scripts for complex projects where as Selenium IDE can only be used to automate simple projects.

Can we ignore Selenium IDE as we can automate all our tests using Selenium 1 and Selenium 2 ?

No, you cannot ignore Selenium IDE. It is the only selenium tool which has record and playback feature.Selenium 1 and Selenium 2 don't have this feature. We can use Selenium IDE to automate simple project.

Why to record and playback ?

There are two reasons to record and playback.
Reason#1 - In order to automate simple scripts, the tester may not require Selenium 1 and Selenium 2 tools, hence tester will just record and playback using Selenium IDE.
Reason#2 - While automating tests using Selenium 1 or Selenium 2, the tester may face problems while writing the automation scripts. In this case the tester will record and playback the test using the Selenium IDE tool and view the automation code generated by the tool. He/She will compare his Selenium 1 or Selenium 2 self written code with Selenium IDE's auto generated code, and make necessary changes to his Selenium 1 or Selenium 2 code in order to make it work.

Advantages of Selenium IDE:
  • Easy for beginners i.e. Requires less or no software development
  • Takes very less time to automate
  • An excellent way of learning Selenium Script Syntax in your desired programming language.
Disadvantages of Selenium IDE:
  • Not suitable for complex applications - Reason -  If something say Application URL gets changed, we need to record all the tests from the beginning. Where as in Selenium RC and Selenium WebDriver, we can change it from a single location such that the URL gets updated in all the test automation scripts. So we cannot maintain the scripts generated using Selenium IDE.
  • Repetition of the code - Reason - Lets say there are two tests. Test1 -> Login to Gmail, View Unread Emails and Logout. Test2 -> Login to Gmail, Send Email and Logout. When we use Selenium IDE to record these tests it will generate automation code for separate Login and Logout actions. So code is repeated. Where as in Selenium RC and Selenium WebDriver we can write automation code for Login & Logout actions and move them to Methods/Functions.  So Test1 will call Login and Logout functions and also Test2 will call the same Login and Logout functions. Hence code is not repeated.
  • Code is not readable as it contains Hard coded values - Reason - Selenium IDE records what ever the actions the User performs while recording a test, hence the code contains Hard coded values. Lets say the User has recorded the Test -> Login to Gmail with User Name - arunmotoori and Password - selenium143 using Selenium IDE. When you read the code that is automatically generated by the Selenium IDE, it will contain the Hard coded values arunmotoori and selenium143. By reading the code we dont know what arunmotoori and selenium143 are. Were as in Selenium RC and Selenium WebDriver we can Parameterise these Hard coded values by replacing them with a valid variable names like Username and Password. Hence the code becomes readable. 
  • Cannot create constants - There are few constants like Application URL, Usernames etc. Since the recorded code contains Hard Coded values, whenever some functionality gets changed say Application URL, we need to read all the recorded tests and make changes to all the tests containing Hard coded Application URL. But where as in Selenium RC and Selenium WebDriver we can parameterise the hard coded values with readable variable names say Applicaition_URL in this case. These variables will be saved as constants in a different place. If the application URL changes in this case, we just update the saved constant with new URL only once, hence no need to reading the code of all the tests.
  • Data Driven tests are not possible - Suppose if you want to run the same Test say -> Login to Gmail with say 100 different Users. Using Selenium IDE you have to record 100 tests (each test for each User). Instead if you use Selenium RC or Selenium WebDriver you can create single test by parenthesizing the User details in the test. Hence you can pass 100 Usernames to the same variable and run the same test 100 times.
  • Hence Framework implementation is not possible - Automation Framework is a set of guidelines like 'Code Re-usability, 'Parametrization' etc. Hence Framework implementation is not possible with Selenium IDE. It is possible with Selenium RC and Selenium WebDriver.





Please comment below to feedback or ask questions.

How to record and playback using the Selenium IDE tool will be explained in the Next Post




3 comments:

ratikant said...

Hi Arun,
can you give brief introduction about Selenium Grid

Arun Motoori said...

@ratikant - Selenium Grid is used to run the automation scripts parallel on more than one machine to reduce time. i.e. Instead of executing all the scripts say 8 on single machine, using Selenium Grid we can execute on more machines say 4 parallel , hence 2 scenarios will be executed on 4 machines to reduce time.

Unknown said...

Really good blog. Selenium learners no need to go anywhere.