Skip to content

Instantly share code, notes, and snippets.

@cuuupid
Created November 21, 2017 06:52
Show Gist options
  • Save cuuupid/c1760fc50547244162311d649d821566 to your computer and use it in GitHub Desktop.
Save cuuupid/c1760fc50547244162311d649d821566 to your computer and use it in GitHub Desktop.
Headless ChromeDriver with selenium
from selenium.webdriver.chrome.options import Options
opts = Options()
opts.add_argument("headless")
# opts.add_argument('no-sandbox')
opts.add_argument('window-size=1200x600')
opts.add_argument('disable-gpu')
opts.add_argument(
"user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36")
driver = webdriver.Chrome(chrome_options=opts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment