Created
June 12, 2017 14:34
-
-
Save joemarchese/68abb17f505831c84e98dde0bcccefc6 to your computer and use it in GitHub Desktop.
Selenium-PhantomJS Screenshooter
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
| import os | |
| import requests | |
| from time import sleep | |
| from selenium import webdriver | |
| from selenium.webdriver.common.desired_capabilities import DesiredCapabilities | |
| dcap = dict(DesiredCapabilities.PHANTOMJS) | |
| driver = webdriver.PhantomJS(os.path.join(os.getcwd() + '\phantomjs.exe'), desired_capabilities=dcap) | |
| sleep(2) | |
| driver.set_window_size(1024, 768) | |
| driver.get('http://www.google.com/') | |
| driver.save_screenshot('test.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment