【发布时间】:2017-08-04 20:51:23
【问题描述】:
所以,我正在使用 nightmare js,并且我喜欢模拟登录过程,为此我使用了这样的 nightmarejs
function testiiing(){
nightmare
.goto('http://localhost:4200/login')
.type('#name', 'test')
.type('#pwd', 'test')
.click('#log')
.evaluate(function() {
return //something
})
.then(function(result) {
console.log(result);
})
.then(function() {
console.log('done');
})
.catch(function(error){
console.error('an error has occurred: ' + error);
});
}
问题是我想将“//something”更改为可以返回“name=test&pwd=test”的东西(所以 ajax 发布请求),有人可以帮助我或告诉我是否可以全部?
【问题讨论】:
-
嗨,我的回答对你有帮助吗?
-
嗨,安德鲁,如果我能找到一种方法让噩梦接受“$”参数,这可能会有所帮助,自从你回答我以来,我一直在寻找一种方法^^
-
对不起什么?你不是在用 jQuery 吗?
-
我们通常可以在 nightmarejs 中注入 jquery,但我现在无法实现 x)
标签: javascript ajax post nightmare