text
Complete Tutorial On Selenium Maven Dependency !!

Join

Subscribe to our Newsletter

While working on a test automation project, we require all the selenium maven dependency connected with it. Usually, these selenium maven dependency are downloaded and upgraded manually throughout the project’s lifecycle, but as the project starts to get more prominent, managing dependencies could become quite challenging. It is the reason why we are required to build automation tools such as TestNG maven dependency for handling them automatically.

Maven could be more specifically defined as a software project management tool that utilizes the project object model (POM). It permits the user to create an initial folder structure, perform accumulation and selenium testing, and then package and dispose of the final product. It could efficiently cut down various steps, followed in the build process, and build a one-step strategy.

Maven is a crucial build automation tool. In this article, we will discuss how to install maven in our selenium testing automation projects and run our first project in the selenium maven dependency tutorial.

How to install maven in Windows?

Maven could be installed either by command line or by using eclipse IDE. We will first learn to install it by using the Eclipse IDE.

How to install maven in Eclipse IDE?

Installing a maven dependency tree in eclipse is a moderately simple procedure. Here are the steps involved in it:

  1. Click on help from the top menu in eclipse and select install new software.
  2. In the newly opened window, click on the add button.
  3. Hindi name text box type even and in the location textbox type “http://download.eclipse.org/technology/m2e/releases/”. This URL is the location from where we can download maven.
  4. A checkbox will appear in the pop-up window; check the checkbox and click on the Next button.
  5. Please wait for a few minutes for the window to perform its process.
  6. Keep the default settings and press the next button.
  7. Click on the finish after accepting the terms and conditions.
  8. Wait for the installation procedure to finish.
  9. What’s the installation is finished, it will ask us to restart our eclipse. Click on yes to see the changes being reflected.

Now we have installed maven successfully into our Eclipse IDE. If we want to go around with the other way of installing it using the command line, please follow the steps given below.

How to install maven using the command line?

Here are the steps that we need to follow for installing the maven dependency tree  through the command line:

1. Download and install Java

We are required to install Java in our system if not already done. The latest version of Java should be downloaded mon our system. To check the Java version in our system, we may open run and type cmd to launch the command prompt, type Java version, and press enters to see which Java version was installed.

2. Setup Java environment variable

After installing Java; we are required to set up the Java environment variable. Open the system settings for setting the Java environment variable.

  • Go to this PC and click on the space anywhere with them, and select properties.
  • Now click on advanced system settings so that a new popup window opens.
  • From the popup window, now click on environment variables.
  • Type Java home in the variable name box and path in the variable value box and save it.
  • We can now see the newly created Java variable under system variables.

3. Download maven and setup maven environment variable

  • We are now required to download maven and extract it to some location on our machine as per our convenience.
  • We cannot set up the maven environment variable related to how we set up the Java environment variable in the above steps.
  • Type maven home in the variable box and ‘C:\apache-Maven-3.6.1’ in the variable value box.
  • We will now be able to see the newly created TestNG Maven dependency variable under system variables.

4. Updating the path variable

To run Maven from the command line, we have to update the path variable with the maven installation directory.

  • Open system properties using my computer.
  • Navigate to advanced system settings.
  • Click on environment variables.
  • Under user, variables click on the edit button.
  • Type in the variable name box and ‘C:\apache-Maven-3.6.1\bin’
  • in the variable value box.

5. Testing the Maven installation

Maven is now successfully installed in our system, so let’s verify it from the Windows command line. Open a command prompt and type mvn-version, and hit enter. We should check now to see the version of Maven installed in our system displayed in the results. We are all set with maven installation; now, we can create projects using Maven.

Creating our first Maven project

As we discussed earlier, just like the maven installation; we can also create a maven project either through eclipse or by command line:

Creating a maven project with Eclipse IDE

Below are these steps for creating a maven project using eclipse IDE:

  1. Create a new project from the eclipse IDE.
  2. From the new project, the window expands me when a unique maven project and then click on next.
  3. We now may create a simple project by just ignore this option. For now, we will use a simple task that will make a simple maven enable java project.
  4. Now, after clicking next, we are required to type information about the maven project we created. We could refer to the below-provided descriptions for filling in the values:

Group ID- corresponds to our organization’s name.

Artifact ID- refers to the project name.

  1. The version could be chosen flexibly; if our projects do not have any parent dependencies, we are not required to fill in the project dependencies and fill in the required information and click on finish.
  2. Our first maven project has now been created.

We may now open the pom.xml for viewing the structure set up by maven. We will now see all the information that we entered above. We can use the tabs at the bottom to change the view. The pom.xml tab has the pom xml code for the maven project. Our maven project is now ready to be used.

Create a maven project using the command line

  • Open the command prompt and navigate to the folder where we want to set up our project. Once guided by the command provided below mvn archetype:generate -DgroupId=demoProject -DartifactId=DemoMavenProject -DarchetypeArtifactId=Maven-archetype-quickstart -DinteractiveMode=false
  • Here, DgroupId is the organization name, DartifactId is the project name, and DarchetypeArtifactId is the Maven project type.
  • On clicking Enter, our Maven project will be created.
  • We can now go to the project location to see the newly created maven project. We can now open the pom.xml file, which is the project folder by default.
  • We can now view the default folder structure of our management project.

In this selenium framework maven tutorial, we explored how maven as a build automation tool could make managing selenium maven dependency better for our project. When we are not required to worry about installing and upgrading our project libraries, they will be done automatically with the tool.

We also know how to install maven in our system with Eclipse IDE and with the command line. We also now know how to create a maven project in eclipse. It is all we need to know for getting started with maven in this selenium framework maven tutorial.

Contact Us

Hire vetted developers & testers with Appsierra to build & scale your software products

Trusted by 100x of startups and enterprise companies like

Read More

Subscribe to Our Newsletter