This simple example demonstrates how to use Selenium Manager in Selenium 4.6 (and above). For the demonstration, I have made use of Selenium 4.11.0
Selenium Manager is a new tool that helps to get a working environment to run Selenium out of the box.
Available with Selenium v4.6 (and above), it automatically configures the browser drivers for Chrome, Firefox, Internet Explorer, and Edge.
More information about Selenium Manager is available in the following locations:
- Add Selenium Java 4.11.0 dependency in pom.xml
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.11.0</version>
</dependency>
Here is all what is needed to instantiate the browsers:
- Chrome ------> WebDriver driver = new ChromeDriver();
- Firefox ------> WebDriver driver = new FirefoxDriver();
- Edge --------> WebDriver driver = new EdgeDriver();
For demonstration, I used the getInstance method in SeleniumManager to print the location where the respective browser drivers are downloaded:
On execution, the browser drivers are downloaded in /Users/applemacbook_pro/.cache/selenium folder. These would be re-downloaded in case there is any update in the browser version.