Sunday, September 16, 2018

What is Selenium - Selenium Introduction | Selenium Testing Tutorial


Hi guys, In this post, I am going to cover -

  • What is Selenium?
  • Advantages and disadvantages of Selenium.
  • Different types of Selenium.
  • Drawbacks of Selenium 1.0
  • Advantages of Selenium 2.0.
  • Selenium 3.0.
  • Who developed Selenium?
  • Different components of Selenium.



What is Selenium?

Selenium is an open source framework which allows automating tests of web-based application across browsers.

Yes across different browsers - Firefox, Internet Explorer, Chrome, Opera, Safari and so on.

Advantages -


  1. It's an open source testing framework. It means one can download it and can use it for automating. There is no cost involved, unlike QTP/UFT.
  2. As I mentioned, it supports testing across various browsers. One can create scripts for test cases and can execute it on different browsers.
  3. It allows creating automation scripts by various languages such as Java, Ruby, Python, JavaScript,  Pearl, C#, .NET, PHP and so on. 
  4. It supports various environments such as Windows, Linux, Mac and so on. It means you can execute your selenium scripts on any operating systems.


Disadvantages -


  1. It only supports testing of the web-based application.
  2. There is no technical support, unlike UFT. We need to rely only on the available customer communities. 
  3. It does not generate a test result report after the execution of tests. We need to integrate selenium with TestNG OR Junit frameworks for test result report generation.
  4. We can not perform image-based testing in Selenium. We need to integrate selenium with sikuli to perform image-based testing.
  5. We need to integrate selenium with Jenkins or Maven to achieve continuous integration testing.

Note - One thing can be observed from the disadvantages that to achieve some particular tasks we need to integrate selenium with other tools or frameworks. Though we need a number of integrations, yet Selenium is in huge demand as a testing framework because of its other advantages. Integration is a one-time activity but once done it will make the testing much easier.



Different types of Selenium - 


  • Selenium 1.0 - (Selenium IDE + Selenium RC +Selenium Grid)
  • Selenium 2.0 - (Selenium IDE + Selenium RC + Selenium WebDriver + Selenium Grid) or (Selenium 1.0 +Selenium WebDriver).
  • Selenium 3.0 - (Selenium IDE + Selenium WebDriver + Selenium Grid ) 

Note - In Selenium 3.0, Selenium RC has been removed.

Drawbacks of Selenium 1.0 -

Selenium 1 is the combination of Selenium IDE and Selenium RC.

Drawbacks of Selenium IDE - 


  • It comes as a plug-in with Firefox and now with Chrome only. It does not provide support for other browsers.
  • It does not provide conditional and iteration operations. It means you cannot put conditional and looping statements while writing scripts.
  • It does not provide Parametrization. It means you cannot perform data-driven testing for your application.
  • It does not provide support for error handling and database testing.
  • We cannot implement frameworks in IDE.
  • It does not support testing of iPhone and Android application.


Drawbacks of Selenium RC - 


  •  Selenium RC requires the server to execute test scripts across browsers. It slows down the tests execution.
  •  Suppose, there is a web element which is disabled on the web page. If a user tries to enter something, then what is the expectation? Definitely, the user will not be able to enter anything in a disabled web page element.But this is not the case in Selenium RC. It can enter a value in the disabled text box(a web page element) also. In the past, many selenium testers complained about this weird behavior.
  • RC's API contains redundancies and confusing commands. User often get confused which commands to use type() or types()click() or  mouseDown() or mouseDownAt(). Apart from that, the different browser interprets each of these commands in different ways too.
  • RC does not provide support for HTMLUnit browser. It a  headless browser because it is invisible that means NO GUI

To overcome these drawbacks, Selenium 2.0 version is released.

Selenium 2.0

Selenium WebDriver is called as Selenium 2.0.

Advantages

  • It provides drivers to work with all the supported browsers.
  • You can use conditional and looping statements in your script.
  • You can perform data driven testing.
  • It has error handling mechanism and provides support for database testing.
  • You can implement different frameworks with your project.
  • Since it directly interacts with browsers, it has faster execution speed.
  • It has clearly defined commands for each of the actions performed on web page elements.
  • It provides a realistic interaction with page elements.
  • It provides support for HtmlUnit browser.

Selenium 3.0

  • Selenium 2.0 had some bug issues. So those bugs got fixed and then Selenium team has released Selenium 3.0. We can say it is the bug fixes from Selenium 2.0. 
  • It does not Provide support to Selenium RC. Selenium RC APIs are moved to 'legacy' package.
  • The most important update is the introduction of Gecko Driver.Mozilla has made some changes to Firefox. If you are using Mozilla Firefox having version above 47, you have to install gecko driver and nave to configure it with your selenium script to automate AUT(Application Under Test) across Firefox browser. Below 47, you don't need to install. Whether you are working on Selenium WebDriver version 2 or 3, if your Firefox version is above 47, you have to install gecko driver. 



Who developed Selenium?


Don't you feel hectic, when you have been asked to do repetitious testing of 20 test cases, each having more than 20-30 test steps?

James Huggins also felt the same.

Well, this is the story of an engineer at ThoughtWorks. He was working on a web-based application that required frequent testing. He realized this repetitious testing insufficient. So, he created a JavaScript program that would automatically control the browser's actions. In another way, to automate the application. He named the program as JavaScriptTestRunner. Later, realizing it's potential to automate other web application also, he made the program open-source and later, renamed as Selenium core. That engineer is James Huggins who developed selenium in 2004.



Different components of Selenium - 

Selenium has four components - 
  1. Selenium IDE .
  2. Selenium RC .
  3. Selenium WebDriver.
  4. Selenium Grid.

1.Selenium IDE 
It comes as a Firefox plugin which provides record and playback feature. It means one can record and replay the tests in Firefox browsers. In the official website of selenium you can get that now selenium IDE comes as an extension of chrome also.

2. Selenium RC

It is a well-designed API(Application Programming Interface) that allows you to design test scripts in various programming languages and execute those tests scripts against different browsers. It requires server intervention to execute the tests across browsers.

3. Selenium WebDriver 

Like RC, WebDriver is also a well-designed API that allows you to design test scripts in various programming languages and execute those tests scripts against different browsers. Unlike RC, it does not require any server intervention to execute the tests.

4. Selenium Grid

It is a distributed environment that allows you to execute tests across different browsers and different OSs. It means you can execute tests scripts on IE on the window and on Safari on Mac. It greatly helps to reduce the tests execution time. It supports cross-browser testing.

So, guys, this is all about the basis of what is Selenium? and different components of selenium. In my next post, I have discussed :

  - Selenium RC

 - Selenium Webdriver

- difference between selenium RC and selenium webdriver.

Follow the link - Difference between selenium RC and Selenium WebDriver.




Guys, do comment in the comment box and share your views about the post. If you have any query, please comment on it. It will help me to reach to you and help you to resolve your query.

Thank you!!!







6 comments:

  1. Can you please provide more information.

    ReplyDelete
  2. Sir this is most needed blog please continue further

    ReplyDelete
  3. yes sure. Everyday I will post one topic of selenium.

    ReplyDelete
  4. Well explained. Able to understand the concepts very clear. Good work

    ReplyDelete
  5. Thank you for sharing wonderful information with us to get some idea about that content.
    Selenium Testing Course Online
    Best Selenium Course Online

    ReplyDelete