zoukankan      html  css  js  c++  java
  • [Node.js] Take Screenshots of Multiple Dimensions for Responsive Sites using Nightmare

    When developing responsive websites, you will constantly be resizing your browser to make sure your site is properly responding to all of the resizes. You can script this behavior by using Nightmare to leverage Electron and it will handle all the resizing for you. Nightmare can then also takes screenshots and save them so you can make sure the site matches your designs.

    const Nightmare = require('nightmare');
    const path = require('path');
    
    const nightmare = new Nightmare({
        show: true,
        frame: false
                                    });
    
    nightmare
        .goto('https://egghead.io')
        .viewport(640, 480)
        .wait(1000)
        .screenshot('./screenshots/640x480.png')
        .viewport(1280, 720)
        .wait(1000)
        .screenshot('./screenshots/1280x720.png')
        .end()
        .then(() => console.log("done"));

    Github

  • 相关阅读:
    vue 定义全局函数和变量
    大学感受
    NOIP2018 游记
    NOI2018 游记
    THUSC 2018 游记
    APIO2018 游记
    SXOI2018游记
    poorpool 的 考场 NOI Linux 配置
    关于 poorpool
    NOIP2017 游记
  • 原文地址:https://www.cnblogs.com/Answer1215/p/6727838.html
Copyright © 2011-2022 走看看