java maven intro code example
Example 1: what is maven
What is MAVEN?
- Maven is a built automation tool.
- Maven is a tool that helps us create projects easyly.
--> What is built?
- Creating, adding, compiling, testing and deploying a project.
All of these combined are called a Built.
- Since maven is "built" automation tool, it helps us automate
all of these steps.
--> Similar tools like Maven?
- ant
- gradle
- kotlin
--> Most important file in a Maven project?
- pom.xml is the most important file in a Maven project.
Example 2: how to create pom
#1- We initialize the web elements using
PageFactory.initElements method
- We create connection in between our Driver
and the object of current class.
- So when we use the object of the class,
the object is already initialized with all
the web elements and able to use them.
PageFactory.initElements(Driver.getDriver(), this);
- #2 - We use @FindBy annotation to locate web elements.
@FindBy (xpath = "//something")
public WebElement exampleBox;