Tuesday, September 25, 2018

Difference between Selenium RC and Selenium WebDriver

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

  • What is Selenium RC.
  • Different components of RC.
  • How RC works?
  • Evolution of WebDriver.
  • WebDriver VS RC.


Selenium RC





Selenium RC is also known as Selenium 1.0.

It has two components -

  1. Selenium remote control server.
  2. Client Library.

1. Selenium RC server 

Selenium RC server acts as a middleman between selenium commands and browsers. Selenium Server receives Selenium commands from test scripts, interprets them, and reports back the results of running those scripts.
2. Client Library
It provides a programming interface between each programming language and RC server. We need a programming language to create test script which has a set of selenium commands. Client Library provides a programming interface(API) which is nothing but a set of functions, which runs selenium commands from your own test script. There is a different client library for each of the supported programming languages.

How RC works?
  1. First, you write the test script.
  2. Before you start running the script, you need to start selenium RC server.
  3. The server will inject a JavaScript program called  Selenium core.
  4. Selenium Core is a JavaScript program. It is actually a set of JavaScript functions which interprets and execute selenium commands based on the browser's inbuilt JavaScript interpreter.
  5. Once you start running the script, the client library takes selenium commands one by one and passes it to the server.
  6. Server now passes the commands in the form of instructions to the selenium core.
  7. Selenium core executes them as JavaScript commands.
  8. The browser will obey the instructions of the selenium core and actions will be performed on the AUT(APPLICATION UNDER TEST).
  9. Based on the actions performed, browser relays its response to the server.
  10. The server then passes the response to the client library.
  11. Client library passes the response back to the script.
  12. Now script receives the response and can store it in a variable and report it as a success or failure.
https://automation-seleniumtutorial.blogspot.com/2018/09/difference-between-selenium-rc-and.html

So, one can observe that the writing script in RC and executing it is how much complex. The notable thing is the use of the server as a middleman. This makes the execution of script slow and hence performance.



Here comes the WebDriver!!!
Selenium 2.0 is also known as WebDriver.

How WebDriver works?

No concept of Server.
Yes, you don't need to start any server. A BIG relief!!!

It controls the browser from the OS level.
All you need are your programming language IDE(most of the case Eclipse) and browser to perform testing.


Now we will see the difference between Selenium RC and Selenium WebDriver -





  1. Speed-  As I discussed above, Selenium RC requires the server to execute test scripts across browsers. But, Webdriver makes a direct connection with the browsers. Thus, Webdriver improves the performance of execution speed as compared to RC.
  2.  Interaction with web page elements - 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. This is how Webdriver interacts with the page elements. It provides a realistic interaction with them. But this is not the case in RC. Selenium core like other javascript code 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.
  3. API - Webdriver' API is more concise in comparison to RC's API. 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. Well, this is not the case in Webdriver. We have click() command for clicking, sendKeys() for entering or typing some data.
  4. Support for the browser - RC does not provide support for HTMLUnit browser. It a  headless browser because it is invisible that means NO GUI
  5. Customised reporting feature - Selenium RC has a feature to provide HTML based report details of all the executed test cases. But Webdriver does not provide such kind of feature.
  6. New browser support - As we know that Webdriver operates on OS level and there is a separate driver provided for each supported browser. Each Browser communicates with the OS in its own way. In such a scenario, if a new browser is released, then definitely it will also have its own way of communicating process with OS and also we won't have a separate driver for it too. So it is totally dependent on Webdriver's team when they will release a separate driver or whether they will provide any support for this new one or not.
This is all about Selenium RC and a quick difference between Selenium RC and Selenium WebDriver. In my next post, I will discuss WebDriver and how to configure WebDriver jar file with Eclipse.




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.

Monday, September 24, 2018

selenium webdriver tutorial | selenium webdriver download

Hi guys,This is the post on -

Selenium WebDriver


 Here, I am going to cover -


  • Selenium Webdriver Introduction.
  • Different WebDriver APIs.
  • What is API?
  • Why WebDriver is  an API not a TOOL.
  • How to configure WebDriver jar files with Java project.


If you want to learn about the basics of Selenium, then you can refer my previous post here -  Selenium Introduction




Selenium Webdriver 


https://automation-seleniumtutorial.blogspot.com/2018/09/webdriver-introduction.html?m=1

It is a well designed API that allows automating test scripts for an application across different browsers.

It provides a number of APIs to automate the application across various browsers -


  • FirefoxDriver
  • GeckoDriver
  • InternetExplorer Driver
  • ChromeDriver
  • HTMLUni Driver
  • OperaDriver
  • SafariDriver
  • Android Driver
  • iPhoneDriver
  • EventFiringWebDriver



Note - Most of the people consider  Webdriver as a tool. But, it is not a tool. It is a collection of APIs.

So, what is an API ?

It stands for Application Programming Interface.

If you are familiar with Java, then you must know about methods/functions concept. We create methods to improve the re-usability of code. 

Let us consider a team of three automation testers is working on to test the Facebook application's "Home", "Profile" and "Find Friends" tabs. To do this, every tester has to login to the Facebook application and then they can reach to their respective tabs to perform testing. It means, "Login" functionality is common to all the testers. So, if they create a method to login to Facebook and call this method from their individual scripts, then they do not need to write the same login functionality's code in their scripts separately. This is called re-usability of code. 

Now comes to API 

It is a set of classes(where we write methods) written to achieve the desired functionality. It means you can configure it to your program and then you can call the methods available in it to perform a particular task for your program.

Example -  Java Database Connectivity(JDBC) is an API in Java that provides methods to query and update data in the database.
Similarly, Webdriver is an API that acts as an interface to provide communication between programming languages and browsers.

In the same way, Selenium WebDriver provides set of classes that consist of several commands(in selenium we call methods as commands) that we can use it in our test scripts to perform a particular task for us. 

So, remember guys, WebDriver is a collection of APIs. NOT A TOOL!!!



Pre-requisite- 

 before creating the first selenium script  -
  • The first thing you need is Eclipse IDE.  I am assuming that you all know how to install Eclipse IDE and configure it with JDK(Java Development Kit) and you have already created some basic programs using Java. If not, then you can search it on Google and you will get a guide on how to do the above-mentioned stuff. 
  • Next step is to download Webdriver jar files and configure it with your Java project. This I will show you.
How to configure WebDriver jar files?

1. Click here to download Selenium Java Client Driver.

You will be navigated to the below  Website - 

2. Scroll down below and stop at Selenium Client & WebDriver Language Bindings.


3. Since we will use the Java language, click on 'Download' link against 'Java' language. At the time of creating this post, the latest version of Selenium is 3.14. In future, the upgraded version will come. So, you can download the upgraded one. 


5. A jar file will be downloaded. Open the jar file by selecting 'show in folder' option. 
6. Extract the jar files. After extracting it will look like -


Note Remember the location of the extracted jar file.

7. Open Eclipse.
8. Now select  'File' > 'New' > 'Java Project' and click on it.


9. Give a project name let's suppose 'SeleniumProject' and Click on 'Finish'.


10. A Java project will be created under the 'Package Explorer' window.

11. Expand the 'SeleniumProject'.
12. Select 'SeleniumProject' > right click on it > Select 'Build Path' > Select 'Configure Build Path' and then click on it.
13. Select 'Libraries' tab and click on ' Add External Jar' button.
14. Navigate to the 'Extracted Jar File'.
15. Open the file and select jar file below 'lib' folder.
Then, click on 'Open' button.
16. Selected jar file will be downloaded. Again click on ' Add External Jar' button and click on 'lib' folder.
17. Select all the available jar files within 'lib' folder and click on 'Open' button.
18. Now you can see all the jar files are loaded. Click on 'Apply' and then 'Ok' button.
19. The 'Jar Files' will be added. You can verify by clicking on 'Referenced Libraries' under your 'SeleniumProject'.
20.  That's it!!! We have configured WebDriver jar files with our project.

So, guys, this is all about Selenium Webdriver and how to configure WebDriver jar files with your Java Project. In my next post, I will cover how to create the first selenium script and execute it in  'Chrome' and 'Firefox' browsers respectively.

Follow the complete tutorial of webdriver in the link- 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!!!







Sunday, September 23, 2018

Selenium Beginners Tutorial | Selenium Testing Tutorials




Hi guys, Welcome to  Selenium tutorial for beginners which is the one-stop platform to learn selenium from scratch till becoming an expert.
This is for those novice learners who have the vision to make a career in  Selenium automation. I have arranged everything in one place. I have created each and every topic in such a way that you will get a picture perfect idea of Selenium.                     

 This tutorial will make you ready for selenium automation and will help you with interviews also.

Here I am providing the roadmap to Selenium -


Basics Of Selenium


  1. Selenium Introduction
  2. Selenium RC VS Selenium WebDriver




Selenium WebDriver




TestNG


  1. TestNG Introduction
  2. Install and Configure TestNG Library in Eclipse IDE
  3. How to Write Selenium Script using TestNG Framework



Selenium Interview Questions

  1. Part 1