Showing posts with label how to install selenium webdriver with eclipse. Show all posts
Showing posts with label how to install selenium webdriver with eclipse. Show all posts

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!!!