Forums

Get screenshot with URL

Any module is there to get screenshots of websites by giving url's.Could you please provide some library like thummer or scremshot 1.0.It will be helpful if you could provide this.

Thanks in advance.

We already have everything you need to get screenshots of webpages. Have a look at this post on our devblog. To take a screenshot using Selenium, just use:

browser.save_screenshot('screenie.png')

Sweet. I didn't know this existed. Any chance you guys will also add phantomjs and capserjs to the mix?

But after taking screenshot via seleinum how to write it to a my file directory?...

The command above will save it to a file called "screenie.png" in the directory where the script is run; if you need it to be somewhere else, just put in a full path eg. /home/tomjoy/my-screenshots/screenshot1.png

@davidk -- we're taking a look at phantomjs -- there's no Debian package for Squeeze yet, so it might not be completely easy to add -- but there does seem to be a precompiled download, so it's definitely worth a go :-)

Ah well. Looks like phantomjs and casperjs are pretty hard to get working with the way that PythonAnywhere separates out everyone's execution environments -- not impossible, but probably a few days' work. I'll add it to our to-do list with an upvote from you, but I can't promise anything soon.

Thanks giles. It's not really a big deal. I just like tinkering so you shouldn't add it just because I want it.

No problem, David -- our general rule is that if something only takes a few minutes to install and doesn't break anything then we just do it :-)

Don't let Nike hear you say that...☺

Hello Glenn,

in your post here (https://www.pythonanywhere.com/forums/topic/157/#id_post_903) can you please have a look at the link you provided?

I've tried to access it but the webpage seems offline. If so, can you please provide another reference about the same topic?

Thanks in advance,

Things have changed a bit over the last seven years :-) We now have this help page on Selenium that explains how to use it. Getting a screenshot, once you have the browser object, would involve calling its get_screenshot_as_file method.

Hi giles,

I have actually found the link you posted but had no time to update this thread before you did it.

Many thanks, I guess it will be useful for anyone else who wants to do the same.