Firefox WebDriver¶
Usage¶
To use the Firefox driver, pass the string firefox
when you create
the Browser
instance:
from splinter import Browser
browser = Browser('firefox')
Note: if you don’t provide any driver to Browser
function, firefox
will be used.
Service¶
Selenium uses the Service class to manage geckodriver. An instance of this class can be given directly to Splinter.
from splinter import Browser
from selenium.webdriver.firefox.service import Service
my_service = Service()
browser = Browser('firefox', service=my_service)
Custom executable path¶
The Service object can be used to specify the path to geckodriver. For example:
from splinter import Browser
from selenium.webdriver.firefox.service import Service
my_service = Service(executable_path='</path/to/geckodriver>')
browser = Browser('firefox', service=my_service)
Specify Profile¶
You can specify a Firefox profile for using on Browser
function
using the profile
keyword (passing the name of the profile as a str
instance):
from splinter import Browser
browser = Browser('firefox', profile='my_profile')
If you don’t specify a profile, a new temporary profile will be created (and deleted when you close
the browser).
Selenium Capabilities¶
from splinter import Browser
browser = Browser('firefox', capabilities={'acceptSslCerts': True})
You can pass any selenium read-write DesiredCapabilities parameters for Firefox.