Introduction- Selenium is one of the most widely used open source Web UI (User Interface) automation testing suite. It was originally developed by Jason Huggins in 2004 as an internal tool at Thought Works. Selenium supports automation across different browsers, platforms and programming languages. Selenium can be easily deployed on platforms such as Windows, Linux, Solaris and Macintosh. Moreover, it supports OS (Operating System) for mobile applications like iOS, windows mobile and android. Selenium supports a variety of programming languages through the use of drivers specific to each language. Languages supported by Selenium include C#, Java, Perl, PHP, Python and Ruby.
Currently, Selenium Web driver is most popular with Java and C#. Selenium test scripts can be coded in any of the supported programming languages and can be run directly in most modern web browsers. Browsers supported by Selenium include Internet Explorer, Mozilla Firefox, Google Chrome and Safari. Selenium can be used to automate functional tests and can be integrated with automation test tools such as Maven, Jenkins, & Docker to achieve continuous testing.
Before Learn Selenium (Prerequisites):-
Before learning the concepts of Selenium, you should have a basic understanding of java or any other object-oriented programming language.
Languages supported by Selenium include C#, Java, Perl, PHP, Python and Ruby.Currently, Selenium Webdriver is most popular with Java and C#. So, if you know any of the languages then it won’t be tough to understand the concepts of Selenium.
Selenium Tools :-
Selenium IDE:- a tool with a Firefox extension to create test commands. Using the Selenium IDE, test cases are recorded and executed so that reusable test commands are generated.
Selenium RC:- allows multiple tests to be performed continuously and works with a Selenium RC server.
Selenium Grid:- can work with multiple servers similar to Selenium RC. It works parallel, which means it can run different tests on different remote machines simultaneously.
For example, let’s write a small test case using Webdriver in python. Firstly, you need to install the selenium module for Python. Then, let’s open Kartaca’s Turkish web page with our application and check the title information.
from selenium import webdriver
self.driver = webdriver.Firefox()
self.assertIn(“Kartaca – Anasayfa”, driver.title)
if __name__ == “__main__”:
Note :- We can write multiple tests into the class we define. Tests run in alphabetical order (according to the method name), and after each test, the tear Down method is automatically called. We can use Firefox’s Firepath and Firebug tools to find the browser elements that will interact with the program.
The elements can be found by the class name (find_element_by_class_name), by CSS (find_element_by_css_selector), by the element id (find_element_by_id). These elements can be a form element or a menu. We can fill out forms using Webdriver’s methods and navigate pages by clicking on the links.
- Selenium is an open source and portable Web testing Framework.
- Selenium IDE provides a playback and record feature for authoring tests without the need to learn a test scripting language.
- It can be considered as the leading cloud-based testing platform which helps testers to record their actions and export them as a reusable script with a simple-to-understand and easy-to-use interface.
- It also supports parallel test execution which reduces time and increases the efficiency of tests.
- Selenium can be integrated with frameworks like Ant and Maven for source code compilation.
- Selenium can also be integrated with testing frameworks like TestNG for application testing and generating reports.
- WebDriver API has been indulged in selenium whichis one of the most important modifications done to selenium.
Mr. Arshad Hussain, Assistant Professor, School of Computer Applications, Career Point University, Kota