If webdriver manager is imported into our selenium code (from webdriver_manager.chrome import ChromeDriverManager), then it is not required that we need to keep updating the browser drivers like chromedriver,geckodriver,... will it keep upgrading itself?
Yes, when we use webdriver_manager
, it helps manage the browser drivers automatically, eliminating the need for manual updates.
The webdriver_manager
library, such as ChromeDriverManager
as you mentioned, provides a convenient way to install and manage browser drivers. It downloads the appropriate driver executable for the specified browser version and operating system.
The advantage of using webdriver_manager
is that it can automatically check the latest version of the browser driver and download the corresponding version if needed. This ensures that your code works with the latest browser and driver versions without requiring manual intervention.
Using webdriver_manager
in your code simplifies the process of managing browser drivers and ensures compatibility between your code and the browser being used.
webdriver_manager
package using pip, including this statement in your code is necessary to ensure that the correct version of the ChromeDriver
is downloaded and installed at runtime. –
Souvaine Although the question is specific to the use of WebDriverManager
, would like to highlight about selenium's new feature. Starting from selenium v4.6.0
and onwards, selenium has an in-built feature known as SeleniumManager
, which essentially is similar to if not same as WebDrivermanager
.
In other words, if you are using selenium v4.6.0
or above, you don't need a third party library(webdrivermanager
) to handle your driver and browsers. Selenium can do it by itself.
Refer the code comparison below:
- Without using
WebDriverManager
and setting thedriver.exe
path manually:
driver = webdriver.Chrome('C:\\Users\\xxx\\Downloads\\chromedriver_win32\\chromedriver.exe')
driver.get("http://www.seleniumhq.org/")
- Using
WebDriverManager
:
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver.get("http://www.seleniumhq.org/")
- Using latest selenium(
v4.6.0
or above):
driver = webdriver.Chrome()
driver.get("http://www.seleniumhq.org/")
References:
© 2022 - 2024 — McMap. All rights reserved.