Let’s get started with the introduction to Selenium!
Firstly I want to ask you some questions about what you understand from Automation. How will it impact your life? Do you know the number of different Automation tools? Have you been fed up with doing Manual tasks?
If multiple answers are juggling in your mind, then let me describe to you all the above questions.Automation is a way which reduces your manual effort, time and opens new opportunities. You enjoy and feel better when you get your task automated. So, we have one of the best Web Automation tools that is Selenium which is widely used in all organizations. Now, you will think we have a number of other Automation tools like-
Then why should we go for Selenium only?
Here are the reasons:
QA Software Testing Training
For using Selenium Core Testers had to install the complete application and Web Server on their Local system so that they can create a Test environment. To overcome this problem another ThoughtWorks Engineer, Paul Hemmant created a server that will act as an HTTP proxy which is known as RC that is Remote Control. It is also known as Selenium1.
Note: RC has been deprecated now. It is not in use now.
An extension of the Firefox browser which supports Record and Playback features for automating an application. It records all the actions of the Browser when you run the browser. Shinya Kasatani Japan created Selenium IDE in 2005.
Simon Stewart developed WebDriver in 2007 which is the first cross Platform Testing Framework. I will explain Selenium Webdriver in detail later.
Selenium is having the main four components:
Do you know the Full form of IDE? Let me tell you the full name is Selenium Integrated Development Environment which is an extension or Addon of Firefox Browser. It is a Record and Play tool to run the script.
Steps on how to Integrate with Firefox
You need to click on the Record button and Open your Browser and perform the action which you want. Selenium IDE will record every action in the form of Script and Selenese command. Although you can modify it as per your requirement. It helps when you are facing a problem during automating your script.
It is a combination of 2 words Web+Driver.
A driver that executes your test scripts against your Web browser. It allows you to choose any browser on which you want to run your Scripts. Hence, cross-browser testing is possible from this.
It allows you to choose any programming language like c,c#, java, Groovy, Python, Ruby
There are four component of Selenium WebDriver
First when a user writes code in Java language so it uses java client library and through JSON wire protocol over HTTP request is sent in the form of URL to selenium browsers driver and after that this request is set on a real browser and after that action performed.
You will learn later you will pass a URL and what exception you face with HTTP protocol.
Here, we see what will happen internally after you click on Run till the launch of the Firefox browser.
Once you click on Run, every statement in your script will be converted as a URL with the help of the JSON Wire Protocol over HTTP. The URL’s will be passed to the Browser Drivers. (In the above code, we took FirefoxDriver). Here in our case the client library (java) will convert the statements of the script to JSON format and communicates with the FirefoxDriver. URL looks as shown below.
Every Browser Driver uses an HTTP server to receive HTTP requests. Once the URL reaches the Browser Driver, then the Browser Driver will pass that request to the real browser over HTTP. Then the commands in your selenium script will be executed on the browser.
Selenium is a widely used tool for those organizations that don’t want to spend money on tools or having a low budget project. Although Selenium and UFT both are used to automate Web applications, there are still several differences. Let’s have a quick view of them.
|1||It can automate Web Based applications only. For Mobile, Desktop application Third-party tool we have to useThird party tool we have to use||It can automate Web, Desktop, hybrid, RPA application. This is one of the main advantage of QTP over Selenium|
|2||Selenium Test Scripts can be run on multiple browsers||It supports only IE and Firefox browsers|
|3||It supports multiple languages||It supports only VB script|
|4||It is open source and anyone can use it without paying any cost. You just need to download and set up the project. I will explain How to set up the project later.||It is a paid tool developed by HP. You need to purchase licenses for it.|
|5||No inbuilt object repository was available. You need to create its repository.||It is a tool with build-in Object repository so easy to use|
|6||For generating the reporting another Test Framework need to integrate like TestNG||Inbuilt Reporting Framework present. Default Test Report generated|
|7||No proper support is available if you need some help. There are online communities available. You can discuss and get your solution||As this is a paid tool so proper support you will get|
|8||Easily integrate with several Paid and Free tools like Maven, Jenkins||It can integrate with an only paid tool|
|9||The Scope is very vast||The Scope is very less due to less job in the market|
I will explain to you how you can set up with Selenium Webdriver so that you can write your script to automate your application.
Step by Step you need to do some installation which is required. Here I am using Java as Programming Language, Eclipse as IDE and Chrome as Browser in my example so Please follow all the steps:
Prerequisites: I think you all aware about Java and Eclipse IDE but those who don't know then any need to worry, You just follow below steps and get started with Selenium
1. Go to Oracle official Website to download Java first
And click on the Download button. You will see the screen below
Click on Agree and Start Free Download.
2. After Java installation completion you need to download Eclipse IDE. Go to Eclipse official site by accessing below link
You will see the icon below. Click on the Download button.
and Download it. After downloading you will get the .exe file as shown below picture. Just run it and you will see Eclipse has been installed in your system.
3. Once you install eclipse then Launch it by using eclipse.exe icon
4. Choose your workspace area and click on the Launch button. Cross the Welcome screen.
5. Now Download Selenium java Client libraries. Go to Selenium official site to download selenium “https://www.selenium.dev/downloads/”
6. Click on the Download link and Save the Selenium-java-3.141.59.zip file folder. Unzip the folder
7. Now download the Chrome Driver to run the script on the Chrome browser. Please visit the below link before downloading the driver. I will explain to you later what exception you could have to face
Note: It is very important to note your Chrome Browser version first to download the Chrome Driver. Otherwise, you will face a compatible issue. As my chrome browser version is 71 so I am using chrome driver 2.46
8. Now you have all the downloads, so are you ready to start?
9. Open your Eclipse->Create New java Projects->Enter Project Name and click on Finish
10. Now Right Click on your Project->Build Path->Configure Build Path->Select Libraries Folder
11. Now click on the Add External JARs..button and add all jar files from the Selenium Client Libraries folder. Click on Apply and close button
I hope you have got How to start with Selenium. I will explain to you in detail how to write the script.
QA Software Testing Training
Selenium has its own life cycle. Selenium Automation has to go with the below phase. Let’s have a quick view
QA Software Testing Training
Selenium Webdriver which is a very important component of Selenium, supports multiple languages, multiple browsers, operating systems and automates mainly regression, sanity, and smoke test suites. It can be easily integrated with another tool, hence Batch Testing, cross-browser testing, Database Testing is possible without any problem. Reporting which is very important after running the suits can easily get from this.
Being a Senior Automation Tester I love to first analyze the things and then deliver quality work. By automating and maintaining my task, I have achieved my goals and also contributed to multitasking projects. I believe in learning new technologies with time.
MS SQL Server
Receive Latest Materials and Offers on Selenium Course