yaph / webshots

A tool to take Web page screenshots with common browser screen resolutions and save them as PNG files.
http://geeksta.net/geeklog/web-page-screenshots-phantomjs-python/
MIT License
68 stars 11 forks source link

Add support for user agents #2

Open LuRsT opened 11 years ago

LuRsT commented 11 years ago

How about another argument for adding custom user agents?

yaph commented 11 years ago

Making the user agent configurable sounds like a sensible thing to do. I found an example on how to do this in PhantomJS in https://github.com/ariya/phantomjs/wiki/Page-Automation

var page = require('webpage').create();
console.log('The default user agent is ' + page.settings.userAgent);
page.settings.userAgent = 'SpecialAgent';
LuRsT commented 11 years ago

Yeah, doing it in phantomjs is not the problem, I think the real problem is cluttering the python script, since adding one more option will create more possible commands.

yaph commented 11 years ago

Agree this can get a bit ugly if more args are added in the future, but adding the user agent as an argument makes sense anyway.