GithubHelp home page GithubHelp logo

isabella232 / wdio-screenshot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chromaui/wdio-screenshot

0.0 0.0 0.0 2.25 MB

A WebdriverIO plugin. Additional commands for taking screenshots with WebdriverIO.

License: MIT License

JavaScript 90.55% CSS 0.91% HTML 8.53%

wdio-screenshot's Introduction

wdio-screenshot

A WebdriverIO plugin. Additional commands for taking screenshots with WebdriverIO.

Build Status Build Status Windows npm package

Browser Support

Build Status

  • Firefox
  • Chrome
  • Internet Explorer
  • Safari
  • iOS1 2

Installation

Install wdio-screenshot via NPM as usual:

$ npm install wdio-screenshot --save-dev

Instructions on how to install WebdriverIO can be found here.

Note: If you want to improve performance, you can install GraphicsMagick.

Configuration

Setup wdio-screenshot by adding a wdio-screenshot key to the plugins section of your WebdriverIO config.

// wdio.conf.js
exports.config = {
  // ...
  plugins: {
    'wdio-screenshot': {}
  },
  // ...
};

Usage

wdio-screenshot enhances an WebdriverIO instance with the following commands:

  • browser.saveViewportScreenshot([fileName], [{options}]);
  • browser.saveDocumentScreenshot([fileName], [{options}]);
  • browser.saveElementScreenshot([fileName], elementSelector, [{options}]);

All of these provide options that will help you to exclude unrelevant parts (e.g. content). The following options are available:

  • exclude String[]|Object[] (not yet implemented)
    exclude frequently changing parts of your screenshot, you can either pass all kinds of different WebdriverIO selector strategies that queries one or multiple elements or you can define x and y values which stretch a rectangle or polygon

  • hide String[]
    hides all elements queried by all kinds of different WebdriverIO selector strategies (via opacity: 0)

  • remove String[]
    removes all elements queried by all kinds of different WebdriverIO selector strategies (via display: none)

Use GraphicsMagick

wdio-screenshot uses GraphicsMagick for image processing when available. Without GraphicsMagick installed, wdio-screenshot fallbacks to Jimp - a image processing library written in JS.

If you want to install GraphicsMagick, follow the instructions below.

Mac OS X using Homebrew

$ brew install graphicsmagick

Ubuntu using apt-get

$ sudo apt-get install graphicsmagick

Windows

Download and install executables for GraphicsMagick. Please make sure you install the right binaries desired for your system (32bit vs 64bit).

License

MIT


1 Scaling of iOS Simulator has to be 100% for properly recorded screenshots (see here)

2 iOS scales the zoom level to fit the website into the viewport when the width of your page is bigger than the viewport. Capturing screenshots of such scaled websites with iOS is experimental and error-prone. If you notice any errors, adjust your viewport settings in your meta tag to disable scaling with <meta name="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">

wdio-screenshot's People

Contributors

jankcat avatar marcbachmann avatar monolithed avatar shilman avatar tmeasday avatar wouterverweirder avatar zinserjan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.