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)
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.
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.
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.
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.
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.
1.2) 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.
2) Creating a Project2.1) Build a new Java project: **File> New> Java Project**.
2.2) Fill in your project name, for instance, "DevicoQA", as is displayed below. Click the "Finish" button.
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 Package3.1) Right-click on the "DevicoQA" project’s name and choose New> Package.
3.2) Fill in a name, for instance, **"AutoTestDevico" and click the "Finish"** button.
4) Creating a new class4.1) Right click on **"AutoTestDevico" and click New> Class**.
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.
4.3) Now the project window displays the following:
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.
5.3) Add 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.
That's all about WebDriver and Eclipse preferences. Now you is able to create the first script in Eclipse and run it using WebDriver.