Selenium Introduction

HOME


As the software development process changes from waterfall to Agile methodology, it becomes essential to use automation for testing. The reason is now there are frequent productions, so to perform regression testing, it is advisable to use automation.

Automation testing means using an automation tool to execute the test scripts. This reduces human intervention, which results in avoiding any human error as well as reduces the test execution time. 

Automation testing is preferable for those test scripts which are executed repeatedly and execution is time-consuming.

Saying this, one should keep in mind that we can’t automate everything. The ideal scenario is to automate that part whose ROI (Return on Investment) is higher in terms of automation. 

What is Selenium??

Firstly, Selenium is not a single automation tool like QTP, but it is basically a suite of software or a set of JAR files to automate web browsers across various browsers. Selenium is used by many companies, but a few to mention are Netflix, Google, HubSpot, Fitbit, and more.

Test Packages of Selenium are:-

         1)    Selenium IDE (Integrated Development Environment) – It is an add-on feature on Mozilla Firefox and Chrome. It is a playback and recording tool. You don’t need to know any language for using this tool.

        2)    Selenium RC (Selenium 1.0)  – RC means Remote Control. Selenium RC was the main Selenium project for a long time before the WebDriver/Selenium merge brought up Selenium 2, the newest and more powerful tool.

       Selenium RC is a tool that allows you to write automated web application UI tests in any programming language against any HTTP website using any mainstream enabled JavaScript enabled browser.

         3)    Selenium Grid – Grid supports parallel execution, which means multiple test scripts can be executed at the same time on multiple browsers. Selenium Grid supports distributed test execution. So, it will speed up the test execution.

      Selenium Grid follows Hub-node architecture. The Hub knows the configuration of each node connected to it. When the Hub receives the information that a test needs to be run along with browser and OS information, then it checks for the available node with the same combination and sends the Selenium command to that node.

      4)    Selenium WebDriver – This is the latest version of Selenium. In WebDriver, web elements are identified on a web browser and then actions are performed on these web elements. Selenium WebDriver supports the testing of dynamic pages where web elements change without reloading the page.

      WebDriver overcomes the problem of single host origin policy which is present in RC.

Now the question is what is a Single Host Origin Policy ??
This is an important aspect of the web application security model. As per this policy, a web browser allows scripts present on the first web page to access the data on the second web page, provided both the web pages have the same origin, which means the URI scheme, hostname, and port number are the same.


Why Selenium??

We know that there are a lot of automation tools in the market like QTP, RFT (Rational Functional Tester), and so on, then why Selenium is so famous.

        1)    Open Source – Selenium is an open-source tool, which means no associated cost of licensing. So, it is very cost-effective in the terms of automating the testing.

       2)    Supports multiple languages, browsers, and Operating systems – Selenium supports multiple languages like Python, Pearl, Ruby, .Net, Java, C#, and PHP. You do need not to know multiple languages to start using Selenium. You should be proficient in any one of the above-mentioned languages and good to go. One of the most important features is that you do need not create the test script in the same language in which the web application is created. Suppose a web application is developed using JavaScript, but we can use any of the above mentioned languages to create Selenium test cases.

      Selenium supports a range of browsers like Google ChromeIEMozilla, Opera, Microsoft Edge, Safari, and Html Driver. It also supports different operating systems such as Windows, MAC, Linux, Android, iOS.

      3)   Supports Parallel and Cross Browser Testing -Selenium supports parallel test execution. That means we can open multiple browsers at the same time and execute the test cases. This decrease the execution time significantly.

       Selenium supports Cross browser test execution. This refers to the fact that we can open different browsers like IE and Chrome and execute the same test cases or different test cases at the same time. This increases the coverage of test execution

      4)    Supports Integration with DevOps, and Continuous Integration flow – Selenium can be easily integrated with various third-party tools like Jenkins, MavenTestNG, JUnit, and Git.

     Jenkins – It is a continuous integration tool and can be integrated with Selenium. Jenkins is used for automatic test execution. That means whenever there is any change in software, Jenkins allows you to run the tests every time and deploy the changes to a new environment when the tests pass. Jenkins is also used for scheduling the tests to run at a specific time.

     Maven – Maven is a build management tool, based on the concept of Page Object Model (POM). It is used to define the structure of the project, dependencies, and build and test management. POM.xml file contains information about the version of web driver. It automatically downloads the necessary files from the repository to the local repository.

     TestNG – TestNG is an open-source automation testing framework. It helps to group and prioritize the test scripts and support data parameterization and reporting features.

     Git– It is an open-source version control system. It allows committing the work locally and then syncing the local copy of the repository with a copy of the server.

       5)    Framework Compatibility – Selenium supports various test automation frameworks like Data Driven, Keyword, or Hybrid. Users can select any type of framework depending on the project requirement. 

    Selenium has lots of methods to locate the elements in a webpage such as DOM, CSSXPath, and so on. It can also be used to test web applications that use JavaScript and AJAX technologies

    6)     Supports mobile Testing – Selenium doesn’t perform mobile testing. But it supports mobile testing with the help of additional software like Selendroid and Appium. This software is based on Selenium, so anyone who is well-versed in selenium can apply the same principles for mobile app testing.

    7)     Supports Database Testing – Selenium WebDriver in itself can’t perform Database Testing, but this can be done by using WebDriver with JDBC (“Java Database Connectivity”) API.  The API lets the user connect and interact with the data source and fetch the data with the help of automated queries.

     8)     System Compatibility – Internet Explorer(IE) and Google Chrome support both 32-bit and 64-bit versions, where you can download and use them based on your system requirement.

   9)    Selenium 3.0 – In Selenium 3.0, all the vendors like Google, Apple, Microsoft, and Firefox have their own drivers to work on Selenium. Selenium 3.0 supports Selenium Grid and Selenium WebDriver and stops using Selenium RC directly. Selenium Core is completely removed from the latest version of Selenium 3.0. 

      Like any other tool, Selenium also has some limitations, such as:-

      1)     Programming knowledge is needed –   Selenium does not support codeless test automation. Testers need to know any one of the programming languages which are supported by selenium.

      2)     No Image Comparison –   Selenium doesn’t support image comparison. To perform image comparison, selenium needs to be integrated with a third-party tool called – Sikuli

      3)    No Official Customer Service Support –  It’s an open-source tool, so there is no official customer support team to address your issues. You can get support from tutorials, chat rooms, and online support, but not from product creators.

      4)     No Reporting facility –   The lack of automation of report generation is one of the biggest disadvantages. But, there are third-party tools that overcome this problem like TestNG, JUnit, Extent Library, and Allure.

Architecture

WebDriver talks to a browser through a driver. Communication is two-way: WebDriver passes commands to the browser through the driver and receives information back via the same route. The driver is specific to the browser, such as ChromeDriver for Google’s Chrome/Chromium, GeckoDriver for Mozilla’s Firefox, etc. The driver runs on the same system as the browser. 

3 thoughts on “Selenium Introduction

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s