[英]Zombie getting error Unhandled rejection Error: Timeout: did not get to load all resources on this page
I am new to zombie JS. 我是僵尸JS的新手。 I want to fill the login fields and post the login form.
我想填写登录字段并发布登录表单。 I tried to code this in zombiejs, but getting below error.
我试图用zombiejs编写此代码,但出现错误。
Unhandled rejection Error: Timeout: did not get to load all resources on this page at timeout (C:\\Users\\sapna.maid\\Desktop\\nodejs\\index\\node_modules\\zombie\\lib \\eventloop.js:601:38) at Timer.listOnTimeout (timers.js:92:15) 未处理的拒绝错误:超时:超时时未加载此页面上的所有资源(C:\\ Users \\ sapna.maid \\ Desktop \\ nodejs \\ index \\ node_modules \\ zombie \\ lib \\ eventloop.js:601:38) .listOnTimeout(timers.js:92:15)
My code snippet is as below: 我的代码段如下:
var zombie = require("zombie");
zombie.waitDuration = '30s';
//Browser.waitDuration = '300s';
var assert = require("assert");
browser = new zombie({
maxWait: 10000,
waitDuration: 30*1000,
silent: true
});
browser.visit("https://example.com", function () {
// fill search query field with value "zombie"
console.log("LOADEDDDD !!!!", browser.location.href);
console.log(this.browser.text('title'));
assert.equal(this.browser.text('title'), 'Welcome - Sign In');
browser.fill('#user', 'user@example.com');
browser.fill('#pass', 'pass@123');
browser.document.forms[0].submit();
console.log(browser.text('title'));
// wait for new page to be loaded then fire callback function
browser.wait(5000).then(function() {
// just dump some debug data to see if we're on the right page
console.log(this.browser.success);
assert.ok(this.browser.success);
console.log("Browser title:: --------- " + this.browser.text('title'));
assert.equal(this.browser.text('title'), 'Dashboard');
})
});
Please help me to resolve this issue. 请帮助我解决此问题。 I am stuck here for long duration.
我在这里呆了很长时间。 Thanks in advance!
提前致谢!
The first problem is that the assertion below fails since the www.example.com
's title is Example Domain
not Welcome - Sign In
第一个问题是以下声明失败,因为
www.example.com
的标题为Example Domain
not Welcome - Sign In
assert.equal(this.browser.text('title'), 'Welcome - Sign In');
Moreover, these lines will most probably also fail since there are no elements with such ids on the page. 此外,这些行很可能也会失败,因为页面上没有具有此类ID的元素。
browser.fill('#user', 'user@example.com');
browser.fill('#pass', 'pass@123');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.