webdriver.Firefox() code example

Example 1: browser = webdriver.firefox() error

browser = webdriver.Firefox(executable_path='enter_path_here')

Example 2: browser = webdriver.firefox() error

# test_geckodriver.py
# https://github.com/mozilla/geckodriver/releases
# geckodriver-v0.28.0-win64.zip

from selenium import webdriver

while True:
    try:
        browser = webdriver.Firefox(executable_path = r'D:/Automation/geckodriver.exe')
    except:
        print('Open browser error: An error occured, retrying...')
        continue
    else:
        print('Success! ;-)')
        break