Quantcast
Viewing all articles
Browse latest Browse all 16

Answer by unutbu for Webdriver Screenshot in Python

Use driver.save_screenshot('/path/to/file') or driver.get_screenshot_as_file('/path/to/file'):

import selenium.webdriver as webdriverimport contextlib@contextlib.contextmanagerdef quitting(thing):    yield thing    thing.quit()with quitting(webdriver.Firefox()) as driver:    driver.implicitly_wait(10)    driver.get('http://www.google.com')    driver.get_screenshot_as_file('/tmp/google.png')     # driver.save_screenshot('/tmp/google.png')

Viewing all articles
Browse latest Browse all 16

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>