capture-screenshot

Capture screenshots in multiple browsers!

  • 所有者: juliangruber/capture-screenshot
  • 平台:
  • 许可证:
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

capture-screenshot

Capture screenshots in multiple browsers. One module, to rule them all!

build status

Browsers

  • Chrome Headless
  • Electron
  • PhantomJS
  • Firefox Headless

Usage

Capture 1024x768 screenshots of https://twitter.com/ in Chrome, Electron and PhantomJS:

const capture = require('capture-screenshot')
const fs = require('fs')

capture({ url: 'https://twitter.com/' })
  .then(imgs => {
    fs.writeFileSync('chrome.png', imgs.chrome)
    fs.writeFileSync('electron.png', imgs.electron)
    fs.writeFileSync('phantomjs.png', imgs.phantomjs)
  })
```, Chrome, Electron, PhantomJS, ---, ---, --, <img alt="chrome" src="https://raw.github.com/juliangruber/capture-screenshot/master/example-chrome.png" width=300 />, <img alt="electron" src="https://raw.github.com/juliangruber/capture-screenshot/master/example-electron.png" width=300 />, <img alt="phantomjs" src="https://raw.github.com/juliangruber/capture-screenshot/master/example-phantomjs.png" width=300 />, ## API

### capture({ url, browsers = ['chrome', 'electron', 'phantomjs'], width = 1024, height = 768 })

Capture a screenshot of `url`, returns a `Promise` which resolves with an Object of Buffers.

Options:

- `url` Page url
- `browsers` The browsers to test
- `width` Viewport width
- `height` Viewport height

## Installation

```bash
$ npm install capture-screenshot

CI

If you use the electron browser, this project requires an xvfb setup to be running in your CI environment.
For an example how to set one up, check out the .travis.yml.
After that, no further setup is required however, as all the executables are
installed automatically.

Sponsors

This module is proudly supported by my Sponsors!

Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my Patreon. Not sure how much of my modules you're using? Try feross/thanks!

License

MIT

Copyright (c) 2017 Julian Gruber <julian@juliangruber.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

主要指标

概览
名称与所有者juliangruber/capture-screenshot
主编程语言JavaScript
编程语言JavaScript (语言数: 1)
平台
许可证
所有者活动
创建于2013-08-26 11:57:06
推送于2023-01-11 00:57:54
最后一次提交2022-04-28 13:23:54
发布数21
最新版本名称v2.0.5 (发布于 2018-02-10 09:00:06)
第一版名称v0.0.0 (发布于 )
用户参与
星数415
关注者数18
派生数32
提交数29
已启用问题?
问题数13
打开的问题数5
拉请求数14
打开的拉请求数3
关闭的拉请求数4
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?