API that takes fullpage screenshots ob websites
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bake fbee4bccb7 client side js 3 months ago
server client side js 3 months ago
.gitignore a lot of new stuff 3 months ago
README.md added install command to readme 3 months ago
browsers.js a lot of new stuff 3 months ago
console.js dont print console.error if null is passed as first argument 3 months ago
docker-compose.yml added redis to docker-compose 3 months ago
example.env updated example.env 3 months ago
image.js a lot of new stuff 3 months ago
index.js replaced the webserver with kue 3 months ago
mkdir.js a lot of new stuff 3 months ago
package-lock.json use kue-ui-express and move jobs into specific modules 3 months ago
package.json use kue-ui-express and move jobs into specific modules 3 months ago
screenshot.js ignore bottom 4 white pixel 3 months ago
webdriver-builder.js throw an error if no browser with the given name exists 3 months ago

README.md

BrowserShot

Just a tool to create a fullpage screenshot of a website using Selenium.

To try it locally, use docker-compose which starts a container containing Firefox and Chrome and install it using npm install --global.

$ npm install --global git+https://git.192k.pw/bake/browsershot
$ browsershot

  Usage: browsershot [options]

  Options:

    --url [url]          URL
    --browser [browser]  Browser (default: firefox)
    --width [px]         Browser width (default: 1280)
    --out [path]         Screenshot path (default: screenshot.png)
    -h, --help           output usage information

It takes a screenshot of the current viewport, scrolls down and takes another one. This normally results in broken images, since absolute and fixed positioned elements will be visible multiple times. To work around that, a first request is sent to the original URL, obtaining the viewport- and the total height. After that, the browser changes to another page, passing the URL and the desired height, where only an iframe with the total height should be shown (see routes/frame.js for an example).

$ browsershot --url https://example.com/ --browser chrome
29.8.2018, 21:23:02 DEBUG take fullpage screenshot using chrome
29.8.2018, 21:23:02 DEBUG get heights of https://example.com/
29.8.2018, 21:23:05 DEBUG open iFrame URL https://iframe.example.com/?url=https://example.com/&height=342
29.8.2018, 21:23:07 DEBUG create screenshot 1
29.8.2018, 21:23:07 DEBUG stitch screenshot.png out of 1 images
29.8.2018, 21:23:07 DEBUG delete 1 temporary images
29.8.2018, 21:23:07 DEBUG compress screenshot.png
29.8.2018, 21:23:07 DEBUG stop webdriver