Fix Chrome Driver Error or Selenium webdriver error


When I started with Selenium in Python my biggest problem was the webdriver issue which I later found that there is an automatic download option in python using some special package.

The webdriver sometimes not compatible with the browser you are using. You have to manually find them from the official websites. This is messy part of selenium, I think.

We can get ride off this problem using webdriver_manager

first you need to install the Python package using pip

pip install webdriver_manager

Now you can use it in your project

from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.firefox import GeckoDriverManager

driver = webdriver.Chrome(executable_path=ChromeDriverManager().install())
driver = webdriver.Firefox(executable_path=GeckoDriverManager().install())

The package will automatically check for compatible version and install it and no more worries about web driver and scrap the web with ease and peace.

1 thought on “Fix Chrome Driver Error or Selenium webdriver error

  1. Pingback: How to run selenium webdriver with headless mode | Manoj's Developer Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.