WebDriver step by step Download and Setup tutorial in Eclipse | DeviQA
LogoDeviQA is the finalist of the Software Testing Award 2019

WebDriver step by step Download and Setup tutorial in Eclipse

By on 2019-05-14T00:00:00.000Z

Learn selenium step by step

Selenium is a tool for automated browser management. Selenium is most common in automation of web application testing. However, with Selenium, you are able to (and even need to!) automate any other routine actions executed through the browser.

Selenium is the central component of a number of other tools and automation frameworks. Using Selenium, you can organize distributed stands, consisting of hundreds of machines with different operating systems and browsers, and even run scripts in the clouds.

The Selenium project develops drivers for Firefox, Internet Explorer, Safari and other browsers, as well as drivers for mobile browsers Android and iOS. The driver for the Google Chrome browser is developed within the framework of the Chromium project, and the driver for the Opera browser (including mobile versions) is developed by Opera Software. Therefore, they are not formally part of the Selenium project, they are distributed and maintained independently. But logically, of course, you can consider them to be part of the Selenium family of products.

The same situation exists with client libraries: libraries for Java, .Net (C #), Python, Ruby, JavaScript are developed within the Selenium project. All other implementations are not relevant to the Selenium project, although, perhaps in the future, some of them may merge into this project.

Selenium is the present and future of automated browser management. If you want to be considered a professional in the field of automating testing of web applications - you should definitely own this tool.

Let's review varieties of Selenium.

Selenium IDE

If you want to do:

A small script for fast automated playback of a bug;

Auxiliary script for performing separate routine actions during manual testing.

You need Selenium IDE - the Firefox browser extension, which allows you to record and playback user actions in the browser.

Selenium WebDriver

If you want to develop:

A robust automation framework that can work with any browser;

A large test suite, including tests with a fairly complex logic of behavior and checks.

You need Selenium WebDriver - a set of libraries for various programming languages ​​that allow you to control the browser from a program written in this programming language.

Selenium Server + Selenium Grid

If you need:

Run tests remotely on different machines with different operating systems and browsers;

Organize a test stand for performing a large number of tests.

You need Selenium Server - it can accept commands from a remote machine where the automation script runs, and execute them in the browser. Several Selenium servers can form a distributed network, called the Selenium Grid, which makes it easy to scale the automation stand.

Let's know how to configure selenium in eclipse.

Eclipse for selenium

To adjust Eclipse with Selenium WebDriver, you should run the Eclipse IDE, create a Workspace, create a Project, Package, Class and add External libraries to the project.


Setting WorkSpace in Eclipse startup

Start Eclipse.

Select the "working directory" for your project. I always choose Workspace for all my projects - AutoQA.

You can alter it later - "Switch Workspace" item in the "File" menu. After selection a workspace, Eclipse will be opened.


Creating a Project

Build a new Java project: File> New> Java Project.

Fill in your project name, for instance, "DevicoQA", as is displayed below. Click the "Finish" button.

If the following window appears, select the "Remember my decision" and click "Yes" button.

Open associated perspective?

After previous actions our created "WordpressSite" project and Project Explorer window will display it.


Creating a new Package

Right-click on the "DevicoQA" project's name and choose New> Package.

Fill in a name, for instance, "AutoTestDevico"and click the "Finish" button.


Creating a new class

Right click on "AutoTestDevico" and click New> Class.

Fill in the class name, for instance, "DevicoTestCase", check the "public static void main" checkbox and click the "Finish" button.

Note: We have chosen the Main method because we want to write test cases in the other classes that will be invoked from this method.

Now the project window displays the following:


Adding external Jar-files into the Java build path

Now is necessary to add Selenium webdriver jar-files in the Java build path.

How to download selenium webdriver.


Open this site: www.seleniumhq.org.


Click on the "Download" tab in the header.


Click on the "Download" link in the "Java" item in the "Selenium Client & WebDriver Language Bindings" section.


Save the file.

Right click on "DevicoQA"> select Properties Java build path. Then, navigate to the "Libraries" tab and click "Add External JARs" button.

Add the Selenium Java jar-file.

also add all the jar-files from the "libs" folder.

Adding all the jar-files from the "libs" folder

Click OK.

That's all about WebDriver and Eclipse preferences. Now you is able to create the first script in Eclipse and run it using WebDriver.