Skip to content

Instantly share code, notes, and snippets.

@kvabapo
Created March 23, 2018 08:51
Show Gist options
  • Select an option

  • Save kvabapo/fa293983f24141a549ec97c99b41e1b9 to your computer and use it in GitHub Desktop.

Select an option

Save kvabapo/fa293983f24141a549ec97c99b41e1b9 to your computer and use it in GitHub Desktop.
Running headless browsers with selenium python
from selenium import webdriver
'''Using Firefox Browser'''
options = webdriver.FirefoxOptions() # selenium 3.8.0 above
options.add_argument('-headless') # alternatively options.set_headless(headless=True)
driver = webdriver.Firefox(firefox_options=options)
driver.get('http://www.google.com')
print(driver.title)
driver.quit()
'''Using Chrome Browser'''
options = webdriver.ChromeOptions() # selenium 3.8.0 above
options.set_headless(headless=True)
driver = webdriver.Chrome(chrome_options=options)
driver.get('http://www.google.com')
print(driver.title)
driver.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment