As we are already aware about the binary files(e.g. chromedriver.exe, geckodriver.exe etc.) that we need to download for every browser such as Firefox, Chrome, IE etc. in order to execute Selenium WebDriver scripts.
Let me remind you of the code line that we write in our script. Let’s take an example of Chrome Browser :
System.setProperty("webdriver.chrome.driver", "chromedriver server path"); WebDriver driver = new ChromeDriver();
And every time, we need to manually download the .exe files whenever browser version got updated in order to avoid unwanted issues.
To avoid downloading these servers manually, WebDriverManager API comes into Picture.
WebDriverManager allows to automate the management of the binary drivers (e.g. chromedriver, geckodriver, etc.) required by Selenium WebDriver.
Basically, it aims to automate the driver management process as it will automatically scan and download the compatible driver version according to the browser installed on your machine. It supports multiple browsers like Firefox, Chrome, Opera, Microsoft Edge, Internet Explorer and PhantomJS.
Implementing WebDriverManager in your Project is very simple as you just need to add one line of code for it.Lets look at few examples :
For Chrome Browser :
WebDriverManager.chromedriver().setup(); WebDriver driver = new ChromeDriver();
For IE :
//32 bit windows WebDriverManager.iedriver().arch32().setup(); Or // 64 bit windows WebDriverManager.iedriver().arch64().setup();
For Firefox :
WebDriverManager.firefoxdriver().setup(); WebDriver driver = new FirefoxDriver();
If you really like the information provided above, please don’t forget to like us on Facebook, you can also leave the comment.