Firefox WebDriver is provided by Selenium. To use it, you need to install Selenium via pip:
[sudo] pip install selenium
The following applications are also required:
Geckodriver must also be available on your operating system's PATH environment variable.
The recommended way is by using Homebrew:
brew install geckodriver
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.
Starting with Firefox 55, Firefox can run in a headless mode.
To use headless mode, pass the headless argument when creating a new Browser instance.
from splinter import Browser
browser = Browser('firefox', headless=True)
To use Firefox's incognito mode, pass the incognito argument when creating a Browser instance.
from splinter import Browser
browser = Browser('firefox', incognito=True)
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).
An extension for firefox is a .xpi archive. To use an extension in Firefox webdriver profile you need to give the path of the extension, using the extensions keyword (passing the extensions as a list
instance):
from splinter import Browser
browser = Browser('firefox', extensions=['extension1.xpi', 'extension2.xpi'])
After the browser is closed, extensions will be deleted from the profile, even if the profile is not a temporary one.
from splinter import Browser
browser = Browser('firefox', capabilities={'acceptSslCerts': True})
You can pass any selenium read-write DesiredCapabilities parameters for Firefox.
splinter.driver.webdriver.firefox.WebDriver