Here, you'll create a Maven project that can be used to write and perform test automation, using the Selenium WebDriver. Before you begin, verify that Java 8 SDK is installed on your computer. Then, use your preferred IDE (we recommend IntelliJ IDEA). Finally, download Maven from https://maven.apache.org/download.cgi. The steps for completion of this process are as follows:
- Open the IDE.
- Create a new Maven project by navigating to File | New | Project.
- Select Maven, and click on Next.
- Enter com.beginningselenium as GroupId and lesson1 as the ArtifactId, and click on Next. Finally, click on Finish.
Next, we'll look at adding Selenium WebDriver to the Maven project's POM.xml file.
- The POM.xml file should open automatically. Before the </project> tag, add the following, and then save the file:
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.11.0</version>
</dependency>
</dependencies>
- Right-click on the project, then navigate to Maven | Reimport.
- Right-click on the src/main/java folder and navigate to New | Package.
- Enter com.beginningselenium.selenium as the name, and click OK.
- Right-click on the new package and navigate to New | Java Class.
- Enter BrowserCheck for the name, and click on OK.
Configuring the development environment for Selenium consists of three simple steps, as follows:
- Installing and configuring the Java SDK
- Installing and configuring an IDE
- Downloading and configuring the browser drivers for all of the required browsers
- Using Maven, or any other means, to ensure that the programming language and IDE will be able to import and use the required Selenium libraries and documentation