Dependency:
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>3.0.0</version>
<scope>test</scope>
</dependency>
Code:
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
OR
WebDriverManager.firefoxdriver().setup();
driver = new FirefoxDriver();
OR
WebDriverManager.iedriver().version("3.0.0").setup();
driver = new InternetExplorerDriver();