With the augment of Selenium Webdriver 3, the onus to provide driver executables for the browser fell on the shoulders of browser makers. Also at this time, any browser which followed W3C compliance had to ensure it allowed automation of itself through Selenium. This information is now historical, as we are looking upto the newest version of Selenium on the block Selenium 4.0. But many projects and setups will still be using Selenium 3.0 and currently this topic is for those projects. Whether the new Selenium will bring any change with browser drivers or not that is still not known.
A big issue we all fell into is providing the driver executable for the browser based on the version on our system. Geckodriver which supports firefox has its own set of versions available compatible with every browser, and Chrome seems to be on a spree to release an upteem number of drivers for various versions of Chrome available – have a look – https://chromedriver.chromium.org/downloads, the point to note is that all these releases don’t have a very large span of time available between them.
Boni Garcia’s WebDriverManager comes to help in here to solve the issue of having available the correct driver version for the browser version you have on your system, or the one on which tests are executing. As per its definition available here - https://github.com/bonigarcia/webdrivermanager, it is a library which automate the management of drivers, required by Selenium WebDriver. The WebDriverManager does its magic by performing the following actions –
In this article we will explore the WebDriverManager module in python, this one is created and maintained by Sergey Pirogov. Let us see the steps we will have to do to use this in our code-
Let us look at the different logs which got generated by WDM[WebDriverManager] as it instantiated Chrome browser using the correct driver version –
To know more about the usage of WebDriverManager for different browser types and various types of settings available with the module, visit this link - https://pypi.org/project/webdriver-manager/
p.s. If there is any error found in this article, please let me know at - info@5elementslearning.dev.