Created
October 22, 2020 10:33
-
-
Save kittinan/ece8159de4c02812c0ff1b8c7d814bfe to your computer and use it in GitHub Desktop.
Python Selenium screenshot capture
This file contains hidden or 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
# pip install -U selenium | |
from selenium import webdriver | |
from selenium.webdriver.chrome.options import Options | |
chrome_options = Options() | |
chrome_options.add_argument("--disable-extensions") | |
chrome_options.add_argument("--window-size=1920,1080") | |
#chrome_options.add_argument("--disable-gpu") | |
#chrome_options.add_argument("--no-sandbox") # linux only | |
chrome_options.add_argument("--headless") | |
# chrome_options.headless = True # also works | |
driver = webdriver.Chrome(options=chrome_options) | |
start_url = "https://www.google.com/maps/@13.7435127,100.5346531,16z/data=!5m1!1e1" | |
driver.get(start_url) | |
driver.save_screenshot("/tmp/s.png") | |
driver.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment