WebDriverManager Overview
WebDriverManager is an open-source Java library that manages the drivers required by Selenium WebDriver. It automates tasks, such as downloading, setting up, and maintaining these drivers, making them available for your testing needs.
Downloading WebDriverManager
Open the Package Manager console by navigating to Tools > NuGet Package Manager > Package Manager Console.
In the Package Manager Console, run the following command:
Install-Package WebDriverManager
Press Enter to execute the command. NuGet will download and install the WebDriverManager package in your project.
After installing the package, you can use WebDriverManager in your C# code to manage the WebDriver binaries for Selenium in your project.
Using WebDriverManager
After installation, you can use WebDriverManager.Net to manage WebDriver binaries for your application or test automatically.
Add the following code while creating Chrome session to check for the latest version of the WebDriver binary file and download the binary WebDriver if it is not already present on your system:
new DriverManager().SetUpDriver(new <Driver>Config());
Depending on your browser replace <driver> with the name of the driver you wish to use.
For example, run the following code for a Chrome driver: DriverManager().SetUpDriver(new ChromeConfig()); Run the following code for an Edge driver: DriverManager().SetUpDriver(new EdgeConfig()); The preceding codes initializes and sets up the WebDriver for the specified browser such as Chrome or Edge, using the WebDriverManager library. |
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article