How to Install and Use Selenium WebDriver Manager Package

Use Python's WebDriver Manager for Google chrome browser driver automation and testing.

Picture of Nsikak Imoh, author of Macsika Blog

You just need to do two simple steps:

Step 1: Install web driver manager package:


pip install webdriver-manager
Install the webdriver-manager package.

How to Use Selenium Web Driver Manager for Google Chrome


from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager

driver = webdriver.Chrome(ChromeDriverManager().install())
Import into project.

How to Use Selenium Web Driver Manager for Chromium


from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.utils import ChromeType

driver = webdriver.Chrome(ChromeDriverManager(chrome_type=ChromeType.CHROMIUM).install())
Import into project.

How to Use Selenium Web Driver Manager for FireFox


from selenium import webdriver
from webdriver_manager.firefox import GeckoDriverManager

driver = webdriver.Firefox(executable_path=GeckoDriverManager().install())
Import into project.

How to Use Selenium Web Driver Manager for Internet Explorer


from selenium import webdriver
from webdriver_manager.microsoft import IEDriverManager

driver = webdriver.Ie(IEDriverManager().install())
Import into project.

How to Use Selenium Web Driver Manager for Opera


from selenium import webdriver
from webdriver_manager.opera import OperaDriverManager

driver = webdriver.Opera(executable_path=OperaDriverManager().install())
Import into project.

For windows only:

If the Opera browser is installed in a location other than C:/Program Files or C:/Program Files (x86) on windows and /usr/bin/opera for all unix variants and mac, then use the below code.


from selenium import webdriver
from webdriver_manager.opera import OperaDriverManager

options = webdriver.ChromeOptions()
options.add_argument('allow-elevated-browser')
options.binary_location = "C:\\Users\\USERNAME\\FOLDERLOCATION\\Opera\\VERSION\\opera.exe"
driver = webdriver.Opera(executable_path=OperaDriverManager().install(), options=options)
Import into project.
Get the Complete Code of Selenium Code Snippets on Github.

Connect with me.

Need an engineer on your team to grease an idea, build a great product, grow a business or just sip tea and share a laugh?