Go To File>>New>>Other
Select maven project and click next
Select checkbox to create simple project and click next
Add Groupid, Artifactid then finished
Folder will be created like below screen
Now need to use POM file to add the required dependencies so double click on pom.xml file then go to pom.xml tab
need to add dependencies in our Maven Project. May be like below code:-
<project xmlns=“http://maven.apache.org/POM/4.0.0” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=“http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd”>
<modelVersion>4.0.0</modelVersion>
<groupId>Mavengroup</groupId>
<artifactId>MavenAft</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>TestMavenProject</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Now need to create Package then class. So need to add package then class. Already created with previously posts then need to add and for more info please read shared posts.
Now add script code in class.Example:-
package mavpack;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
//import org.openqa.selenium.firefox.FirefoxDriver;
//import org.testng.annotations.Test;
public class MavC {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty(“webdriver.chrome.driver”,”C:\\chromedriver.exe”);
WebDriver driver =new ChromeDriver();
//WebDriverWait wait = new WebDriverWait(driver, 40);
driver.get(“http://qatestingtips.com/”);
}
}
now run project by pom.xml
See build is successful