Created
August 29, 2020 10:47
-
-
Save ddmitov/5bbd25167a52ab83e32ff105ba92d2ad to your computer and use it in GitHub Desktop.
Minimal testing script for the Selenium Python package
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
#!/usr/bin/python3 | |
import os | |
from selenium import webdriver | |
from selenium.webdriver.chrome.options import Options | |
chrome_options = Options() | |
chrome_options.add_argument('--headless') | |
chrome_options.add_argument('--window-size=1920x1080') | |
# Download the chrome driver from | |
# https://sites.google.com/a/chromium.org/chromedriver/downloads | |
# and put it in the current directory: | |
chrome_driver = os.getcwd() + '/chromedriver' | |
driver = webdriver.Chrome( | |
chrome_options=chrome_options, | |
executable_path=chrome_driver | |
) | |
driver.get('https://www.google.com') | |
driver.get_screenshot_as_file('capture.png') | |
driver.close() | |
driver.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment