Last active
March 4, 2021 19:06
-
-
Save jeromew21/1f1b3aa567dee7a51827b4aa5b3645a0 to your computer and use it in GitHub Desktop.
[Python] Start Selenium Firefox driver in headless (invisible) mode.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.firefox.options import Options | |
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary | |
options = Options() | |
options.set_headless(True) | |
binary = FirefoxBinary("/usr/bin/firefox") #Linux. In Windows/Mac this is different | |
driver = webdriver.Firefox(firefox_options=options, firefox_binary=binary) | |
print("started firefox in headless mode") | |
#Drive the invisible browser | |
driver.get('http://google.com/') | |
driver.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment