zoukankan      html  css  js  c++  java
  • node nightmare 网页自动化测试 sample

    安装nightmare

    编写1.js

    运行 node 1.js

    var Nightmare = require('nightmare');
    var nightmare = Nightmare({ show: true })

    nightmare
    .goto('http://yahoo.com')
    .type('form[action*="/search"] [name=p]', 'github nightmare')
    .click('form[action*="/search"] [type=submit]')
    .wait('#main')
    .evaluate(function () {
    return document.querySelector('#main .searchCenterMiddle li a').href
    })
    .end()
    .then(function (result) {
    console.log(result)
    })
    .catch(function (error) {
    console.error('Search failed:', error);
    });

  • 相关阅读:
    bzoj1027
    bzoj1069
    poj2079
    poj2187
    bzoj2281
    bzoj2285
    bzoj1558
    bzoj1822
    bzoj1559
    bzoj1570
  • 原文地址:https://www.cnblogs.com/cutepig/p/5656461.html
Copyright © 2011-2022 走看看