Skip to content

Instantly share code, notes, and snippets.

@zhunhung
Created January 13, 2020 13:04
Show Gist options
  • Save zhunhung/091106fd518d0458b50c582d71857d79 to your computer and use it in GitHub Desktop.
Save zhunhung/091106fd518d0458b50c582d71857d79 to your computer and use it in GitHub Desktop.
Script to verify selenium works
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
CHROMEDRIVER_PATH = '/usr/local/bin/chromedriver'
WINDOW_SIZE = "1920,1080"
chrome_options = Options()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--window-size=%s" % WINDOW_SIZE)
chrome_options.add_argument('--no-sandbox')
driver = webdriver.Chrome(executable_path=CHROMEDRIVER_PATH,
chrome_options=chrome_options
)
driver.get("https://www.google.com")
print(driver.title)
driver.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment