Selenium ChromeDriver issue using Webdriver Manager for Python

We Are Going To Discuss About Selenium ChromeDriver issue using Webdriver Manager for Python. So lets Start this Python Article.

Selenium ChromeDriver issue using Webdriver Manager for Python

  1. How to solve Selenium ChromeDriver issue using Webdriver Manager for Python

    There are two issues in your code block as follows:
    You need to import ChromeDriverManager from webdriver_manager.chrome
    As per Webdriver Manager for Python download_and_install() isn't supported and you have to use install()
    So your effective code block will be:
    from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager driver = webdriver.Chrome(ChromeDriverManager().install()) driver.get("http://www.python.org")
    On windows-10 system the console output will be:
    C:\Users\Admin\Desktop\Python Programs>python webdriver-manager_ChromeDriverManager.py [WDM] - [WDM] - ====== WebDriver manager ====== [WDM] - Current google-chrome version is 95.0.4638 [WDM] - Get LATEST driver version for 95.0.4638 [WDM] - There is no [win32] chromedriver for browser 95.0.4638 in cache [WDM] - Get LATEST driver version for 95.0.4638 [WDM] - Trying to download new driver from https://chromedriver.storage.googleapis.com/95.0.4638.54/chromedriver_win32.zip [WDM] - Driver has been saved in cache [C:\Users\Admin\.wdm\drivers\chromedriver\win32\95.0.4638.54] DevTools listening on ws://127.0.0.1:50921/devtools/browser/c26df2aa-67aa-4264-b1dc-34d6148b9174
    You can find a relevant detailed discussion in ModuleNotFoundError: No module named 'webdriver_manager' error even after installing webdrivermanager

  2. Selenium ChromeDriver issue using Webdriver Manager for Python

    There are two issues in your code block as follows:
    You need to import ChromeDriverManager from webdriver_manager.chrome
    As per Webdriver Manager for Python download_and_install() isn't supported and you have to use install()
    So your effective code block will be:
    from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager driver = webdriver.Chrome(ChromeDriverManager().install()) driver.get("http://www.python.org")
    On windows-10 system the console output will be:
    C:\Users\Admin\Desktop\Python Programs>python webdriver-manager_ChromeDriverManager.py [WDM] - [WDM] - ====== WebDriver manager ====== [WDM] - Current google-chrome version is 95.0.4638 [WDM] - Get LATEST driver version for 95.0.4638 [WDM] - There is no [win32] chromedriver for browser 95.0.4638 in cache [WDM] - Get LATEST driver version for 95.0.4638 [WDM] - Trying to download new driver from https://chromedriver.storage.googleapis.com/95.0.4638.54/chromedriver_win32.zip [WDM] - Driver has been saved in cache [C:\Users\Admin\.wdm\drivers\chromedriver\win32\95.0.4638.54] DevTools listening on ws://127.0.0.1:50921/devtools/browser/c26df2aa-67aa-4264-b1dc-34d6148b9174
    You can find a relevant detailed discussion in ModuleNotFoundError: No module named 'webdriver_manager' error even after installing webdrivermanager

Solution 1

There are two issues in your code block as follows:

  • You need to import ChromeDriverManager from webdriver_manager.chrome
  • As per Webdriver Manager for Python download_and_install() isn’t supported and you have to use install()

So your effective code block will be:

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager

driver = webdriver.Chrome(ChromeDriverManager().install())
driver.get("http://www.python.org")

On system the console output will be:

C:\Users\Admin\Desktop\Python Programs>python webdriver-manager_ChromeDriverManager.py
[WDM] -

[WDM] - ====== WebDriver manager ======
[WDM] - Current google-chrome version is 95.0.4638
[WDM] - Get LATEST driver version for 95.0.4638
[WDM] - There is no [win32] chromedriver for browser 95.0.4638 in cache
[WDM] - Get LATEST driver version for 95.0.4638
[WDM] - Trying to download new driver from https://chromedriver.storage.googleapis.com/95.0.4638.54/chromedriver_win32.zip
[WDM] - Driver has been saved in cache [C:\Users\Admin\.wdm\drivers\chromedriver\win32\95.0.4638.54]

DevTools listening on ws://127.0.0.1:50921/devtools/browser/c26df2aa-67aa-4264-b1dc-34d6148b9174

You can find a relevant detailed discussion in ModuleNotFoundError: No module named ‘webdriver_manager’ error even after installing webdrivermanager

Original Author undetected Selenium Of This Content

Solution 2

Here my solution:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager

options = webdriver.ChromeOptions()
s = Service('chromedriver/chromedriver96.exe')
driver = webdriver.Chrome(service=s, options=options)

Original Author jarh1992 Of This Content

Solution 3

  1. Install Webdriver Manager for Python:
    pip install webdriver-manager
  2. Import ChromeDriverManager:
    from webdriver_manager.chrome import ChromeDriverManager
  3. Use webdriver:
    service = ChromeService(executable_path=ChromeDriverManager().install())
    driver = webdriver.Chrome(service=service)

Original Author Eduard Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

ittutorial team

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment