Using WebDriver Manager in Maven Project

This blog post will demonstrate how to use the WebDriver management in a Maven project.

  1. Create Maven project as shown in previous blog.
  2. Create a new package under src/test/java:
    Right click on Project name → New → Package → Enter package name → Finish.

  3. Create New class:
    Right click on Package name → New → Class → Enter class name → Finish.


  4. Visit Maven Repository: Search/Browse/Explore (mvnrepository.com)
  5. Search webdrivermanager in the searchbox and select below option
  6. Select latest version.

  7. Copy given code and paste it into pom.xml file.

  8. Enter below code in class file you created.

    package TestCases;

    import org.openqa.selenium.WebDriver;

    import org.openqa.selenium.edge.EdgeDriver;

    import io.github.bonigarcia.wdm.WebDriverManager;

    public class TestcaseOne {

    public static void main(String[] args) {

    // TODO Auto-generated method stub

    WebDriverManager.edgedriver().setup();

    WebDriver driver = new EdgeDriver();

    driver.get("https://www.youtube.com");

    driver.manage().window().maximize();

    driver.close();

    }

    }

    9. Run code and you should see edge browser opened.

Comments

Popular Posts