This implementation integrates the webdriver_manager module.
Chrome Browser Example:
from splinter import Browser
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.chrome.service import Service as ChromiumService
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.core.os_manager import ChromeType
executable_path = {'executable_path': ChromeDriverManager().install()}
driver = Browser('chrome', **executable_path, headless=False)
url = 'https://google.com'
driver.visit(url)
Brave Browser Example:
from splinter import Browser
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.service import Service as BraveService
from webdriver_manager.core.utils import ChromeType
executable_path = {'executable_path': ChromeDriverManager(chrome_type=ChromeType.BRAVE).install()}
option = webdriver.ChromeOptions()
option.binary_location = "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"
driver = Browser('chrome', **executable_path, options=option, headless=False)
url = 'https://google.com'
driver.visit(url)
*** Update for Brave - executable path argument no longer needed:
option = webdriver.ChromeOptions()
option.binary_location = "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"
driver = Browser('chrome', options=option, headless=False)
url = 'https://google.com'
driver.visit(url)
** Note: I have only tested this on Brave, the Firefox example I assume the same template.
Firefox Browser Example:
from splinter import Browser
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from webdriver_manager.firefox import GeckoDriverManager
from selenium.webdriver.firefox.service import Service as FirefoxService
executable_path = {'executable_path': GeckoDriverManager().install()}
option = webdriver.ChromeOptions()
option.binary_location = "/Applications/Firefox.app/Contents/MacOS/firefox"
driver = Browser('firefox', **executable_path, options=option, headless=False)
url = 'https://google.com'
driver.visit(url)
firefox options:
https://splinter-test.readthedocs.io/en/latest/drivers/firefox.html