Skip to content

Instantly share code, notes, and snippets.

@im-noob
Last active January 19, 2021 15:53
Show Gist options
  • Save im-noob/ff5880b11e591770de48aac22e4af19e to your computer and use it in GitHub Desktop.
Save im-noob/ff5880b11e591770de48aac22e4af19e to your computer and use it in GitHub Desktop.
selenium starter code snippets boilerplate code
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
CHROME_PATH = '/usr/bin/google-chrome'
CHROMEDRIVER_PATH = './chromedriver'
url = 'https://google.com'
chrome_options = Options()
# chrome_options.headless = True
# chrome_options.add_argument('--user-data-dir=./User_Data')
# preferences = {
# # "profile.default_content_settings.popups": 0,
# "download.default_directory": os.getcwd() + os.path.sep,
# # "directory_upgrade": True
# }
# chrome_options.add_experimental_option('prefs', preferences)
chrome_options.binary_location = CHROME_PATH
driver = webdriver.Chrome(executable_path=CHROMEDRIVER_PATH, options=chrome_options)
driver.maximize_window()
driver.get(url)
if __name__ == '__main__':
print('Hello')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment