/ automation-testing

WebDriver step by step Download and Setup tutorial in Eclipse

By DeviQA on Tue Mar 14 2017 00:00:00 GMT+0000 (Coordinated Universal Time)

WebDriver step by step Download and Setup tutorial in Eclipse

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.

1) Setting WorkSpace in Eclipse startup

1.1) Start Eclipse.

Start Eclipse

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

Eclipse launcher. Select a directory as workspace

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

2) Creating a Project
2.1) Build a new Java project: **File> New> Java Project**. Build a new Java project

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

Create a Java Project

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

![Open associated perspective?](/static/images/posts/WebDriverStepByStepDownloadAndSetupTutorialInEclipse/WebDriverStepByStepDownloadAndSetupTutorialInEclipse05.jpg)

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

3) Creating a new Package
3.1) Right-click on the "DevicoQA" project’s name and choose New> Package. Creating a new Package in eclipse

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

Filling in a name in eclipse
4) Creating a new class
4.1) Right click on **"AutoTestDevico" and click New> Class**. Creating a new class in eclipse

4.2) 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.

Fill in the class name

4.3) Now the project window displays the following:

Project window
5) Adding external Jar-files into the Java build path

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

5.1) How to download selenium webdriver.

5.1.1) Open this site: www.seleniumhq.org.

5.1.2) Click on the “Download” tab in the header. 5.1.3) Click on the “Download” link in the “Java” item in the “Selenium Client & WebDriver Language Bindings” section.

5.1.4) Save the file.

5.2) Right click on **"DevicoQA"**> select Properties> Java build path. Then, navigate to the **"Libraries" tab and click "Add External JARs"** button. Adding external Jar-files into the Java build path

5.3) Add the Selenium Java jar-file.

Adding the Selenium Java jar-file 5.4) also add all the jar-files from the “libs” folder. ![Adding all the jar-files from the “libs” folder](/static/images/posts/WebDriverStepByStepDownloadAndSetupTutorialInEclipse/WebDriverStepByStepDownloadAndSetupTutorialInEclipse13.jpg)

5.5) Click OK.

Java build path

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