Module for creating a screenshot of a web page given a URL?

Rune Strand rune.strand at gmail.com
Wed Jul 5 16:30:07 EDT 2006


dananrg at yahoo.com wrote:
> Is there a Python module that, given a URL, will grab a screenshot of
> the web page it goes to? I'd like to be able to feed such a module a
> list of URLs from a file.
>
> Thanks very much.

Not as I know of, but it's easy to write

Something like this quasi-code:

import time,webbrowser
from PIL import ImageGrab

list_of_urls = [''http://www.google.com', 'http://www.egg.net']

for url in list_of_urls:
     webbrowser.open(url)
     time.sleep(5)  # wait for it to load
     screen = ImageGrab.grab(coords etc)
     screen.save(some_name_in_some_path)

Untestetd, but I'm pretty sure something like this will do.
If you need more control, and on windows, try pywinauto




More information about the Python-list mailing list