SELENIUM BASICS:


SELENIUM WEBDRIVER:


TESTNG:


REPORTS:


BUILD & CONTINUOUS INTEGRATION TOOLS:


CROSS BROWSER TESTING:


MOBILE TESTING:


AUTOMATION FRAMEWORKS:


API Testing:


INTERVIEW QUESTIONS:


SAMPLE RESUME:

How To Create Selenium Maven Project In Eclipse IDE | Selenium Tutorial

Create Selenium Maven Project In Eclipse IDE:

In the earlier post, we have see “Installation of Maven in Eclipse“. In this post, we will see How To Create Selenium Maven Project in Eclipse IDE.

Make sure TestNG is already installed. Check this out to see “How To Install TestNG In Eclipse” and this check this link for “TestNG Complete Tutorial

To create a project – Right click on Package Explorer and navigate through NewOther

Install Maven

Select Maven Project and click on NextInstall Maven

Select ‘Create a simple project‘ check box and click NextCreate Maven ProjectFill the Group Id, Artifact Id and click the Finish button

Create Maven Project Structure of the project looks as shown in the below image

Create Maven Project

In the maven project, we use POM file to add the required dependencies. Double click on pom.xml file and click on pom.xml tab

Create Maven Project

 

We need to add some dependencies related to Selenium WebDriver, TestNG in our Maven Project.

Create Maven Project

Create a TestNG class and generate testng.xml file. Check the below link to do this step.

How to create a TestNG class and generate testng.xml file

Create Maven Project

Copy the below code and place it in your NewTest class

testng.xml: testng.xml file looks like below. Copy and place it in your testng.xml

To run the project using testng.xml, right click on ‘testng.xml’ file and go to Run As – TestNG Suite

To run the project using pom.xml, we need to add some more entries in the pom.xml file. We need to add ‘maven-compiler-plugin’ and ‘maven-surefire-plugin’

pom.xml

To run the project using pom.xml, right click on ‘pom.xml‘ file and go to ‘Run As‘ – ‘Maven test

Result:

This way we create Selenium Maven Project in Eclipse. If you have any queries, please mention in the comments section below.

Get our latest blog posts delivered to your inbox

Subscribe and get popular blog posts about software testing industry.

Rajkumar

4 thoughts on “How To Create Selenium Maven Project In Eclipse IDE | Selenium Tutorial”

  1. Hi,

    I created Maven project with TestNg. When I am trying to run it getting below error:

    “java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory”

    I added Selenium and TestNG dependencies in pom.xml

    Please look into it and help me with this.

    Thanks in advance!!!

    • Hi Vipul Shah, try to add dependency ‘commons-logging’ in your pom.xml.

      • I added “commons-logging” dependency in pom.xml. I am getting authorization error.

        • Hi Vipul, comment it and see.

Leave a Comment

Share via
Copy link
Powered by Social Snap