How to take a screenshot of a website with Python, Windows environment ?
Remarks :
The question of taking a screenshot of a website with Python has been highly discussed here but most of the solutions only work for Mac like
webkit2png
(see the discussion here about portability and also this answer) or LinuxThe only half-working solution I've found is :
from selenium import webdriver browser = webdriver.Firefox() browser.get('http://www.example.com') browser.save_screenshot('test.png')
it works 50% of the time, but when doing it for 100 pages, in a loop, it always stops / is stuck / after 10 or 15 or 25 pages. Even if I
time.sleep(...)
, etc.