Fix Selenium error: geckodriver executable needs to be in PATH
Selenium needs a driver (geckodriver for Firefox). Recent Selenium versions include Selenium Manager, which downloads the driver for you:
pip install -U selenium
from selenium import webdriver driver = webdriver.Firefox()
If you must use your own driver file:
from selenium.webdriver.firefox.service import Service
driver = webdriver.Firefox(service=Service("/path/to/geckodriver"))