Thursday, July 12, 2018

Configure Selenium WebDriver using Gradle in Eclipse

Gradle is an extensive build tool and dependency manager which allow you to manage project dependencies SUPER EASY.
To configure Selenium WebDriver using Gradle in Eclipse, we need to perform the following steps:
1) Start your Eclipse IDE by double click on ‘eclipse.exe‘ in eclipse installation folder.
    And create a new Gradle Project from File > New > Project.

2) Choose Gradle > Gradle Project option, and click 'Next'. 


3) Click 'Next' on the Gradle Welcome page.


4) Give a Project name, for example, 'SeleniumGradle' and click 'Finish' button.


5) Open the Gradle configuration file 'build.gradle'. There is the 'dependencies' section for adding project dependencies. You can search dependencies from The Central Repository


6) Let's search for 'selenium-java' to find selenium libraries.


7) The latest version of selenium is 3.13.0 which updated on 25-Jun-2018.


8) Click the version link '3.13.0' to the detail page.


9) Copy the code line under 'Gradle/Grails' section. 


10) Paste the code into 'build.gradle' file under 'dependencies' section.


11) Then, right-click the project and select the Gradle > Refresh Gradle Project to refresh the dependencies in the project.


12) After refresh project completed, you may find all selenium libraries have been imported into the project. 


Then you are ready to add automation test now.


No comments:

Post a Comment