Setting up Selenium Project Using Maven
We will use Eclipse IDE and Maven for building the Selenium WebDriver test framework.
- Launch the Eclipse IDE.
- Create a new project by selecting [File -> New -> Other] from Eclipse Main Menu.
- On the New dialog, select [Maven -> Maven Project] as shown in the following screenshot:
- Click on [Next], the New Maven Project dialog will be displayed. Select the [Create a simple project (skip archetype selection)] check-box and set everything to default and click on the Next button as shown in the following screenshot:
- On the New Maven Project dialog box, enter base package name (like com.myproject.app) in Group Id and project name (like myproject) in Artifact Id textboxes. You can also add a name and description but it is optional. Set everything to default and click on the [Finish] button as shown in the following screenshot:
- Eclipse will create the myproject project with a structure (in Package Explorer) similar to the one shown in the following screenshot:
7. The JRE version might change based on the Java version installed on your machine.
Right-click on JRE System Library [J2SE-1.5] and select the Properties option from the
- Select pom.xml from Package Explorer. This will open the pom.xml file in the editor area with the Overview tab open. Select the pom.xml tab instead.
- Add the WebDriver and TestNG
dependencies highlighted in the following code snippet, to pom.xml in
- Right click on pom.xml from Package Explorer & Select [Run As -> Maven Install]