Created
September 5, 2016 02:24
-
-
Save automata/a5b65a4c882956afbada8f41143eb2cc to your computer and use it in GitHub Desktop.
Screenshot HTML content
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# First install phantomjs: `npm install phantomjs` | |
./node_modules/.bin/phantomjs script.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var page = require('webpage').create(); | |
html = '<html><head><style>button { height: 301px }</style></head><body><button>A simple button</button></body></html>'; | |
viewport = { width: 0, height: 0 }; | |
page.viewportSize = viewport; | |
page.content = html; | |
console.log(page.evaluate(function(){ | |
return JSON.stringify({ | |
"document.body.scrollHeight": document.body.scrollHeight, | |
"document.body.offsetHeight": document.body.offsetHeight, | |
"document.documentElement.clientHeight": document.documentElement.clientHeight, | |
"document.documentElement.scrollHeight": document.documentElement.scrollHeight | |
}, undefined, 4); | |
})); | |
phantom.exit(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment