{"id":80,"date":"2012-08-27T06:01:28","date_gmt":"2012-08-27T05:01:28","guid":{"rendered":"http:\/\/www.schuerig.de\/michael\/blog\/?p=80"},"modified":"2021-11-24T09:20:32","modified_gmt":"2021-11-24T08:20:32","slug":"scripted-screenshots","status":"publish","type":"post","link":"https:\/\/www.schuerig.de\/michael\/blog\/index.php\/2012\/08\/27\/scripted-screenshots\/","title":{"rendered":"Scripted Screenshots"},"content":{"rendered":"<p>I recently needed to make a screenshot of an entire web page, i.e. not just the part the fits on the screen (or in the viewport), but the whole thing from top to bottom.<\/p>\n<p>Somehow I missed the possibility that there might be a zillion browser extensions for just this purpose. From writing <em>features<\/em> (acceptance tests) with <a href=\"http:\/\/cukes.info\/\">Cucumber<\/a> I&#8217;m familiar with <a href=\"http:\/\/phantomjs.org\/\">PhantomJS<\/a>, a &#8220;headless&#8221;, scriptable browser based on WebKit.<\/p>\n<p>Here&#8217;s how it works:<\/p>\n<p><code><\/p>\n<pre>\r\n$ webshot --help\r\nUsage: webshot [OPTIONS]... URL IMAGE_FILE\r\n\r\nOptions:\r\n          -j|--jquery           Inject jQuery into the page.\r\n         +-e|--exec \u00abvalue\u00bb     Execute script in page context.\r\n         +-f|--file \u00abvalue\u00bb     Execute script file in page context.\r\n          -v|--viewport \u00abvalue\u00bb Viewport size WxH; default 1280x800.\r\n\r\n          (* mandatory option)\r\n          (+ repeatable option)\r\n<\/pre>\n<p><\/code><\/p>\n<p><script src=\"https:\/\/gist.github.com\/3481306.js\"> <\/script><\/p>\n<p>Luckily, I didn&#8217;t have to write the commandline parsing myself. But it was fun to figure out how <code><em>Deferreds<\/em><\/code> might be implemented.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently needed to make a screenshot of an entire web page, i.e. not just the part the fits on the screen (or in the viewport), but the whole thing from top to bottom. Somehow I missed the possibility that &hellip; <a href=\"https:\/\/www.schuerig.de\/michael\/blog\/index.php\/2012\/08\/27\/scripted-screenshots\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,9],"tags":[],"class_list":["post-80","post","type-post","status-publish","format-standard","hentry","category-javascript","category-tools"],"_links":{"self":[{"href":"https:\/\/www.schuerig.de\/michael\/blog\/index.php\/wp-json\/wp\/v2\/posts\/80","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.schuerig.de\/michael\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.schuerig.de\/michael\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.schuerig.de\/michael\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.schuerig.de\/michael\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=80"}],"version-history":[{"count":4,"href":"https:\/\/www.schuerig.de\/michael\/blog\/index.php\/wp-json\/wp\/v2\/posts\/80\/revisions"}],"predecessor-version":[{"id":84,"href":"https:\/\/www.schuerig.de\/michael\/blog\/index.php\/wp-json\/wp\/v2\/posts\/80\/revisions\/84"}],"wp:attachment":[{"href":"https:\/\/www.schuerig.de\/michael\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=80"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.schuerig.de\/michael\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=80"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.schuerig.de\/michael\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=80"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}