簡體   English   中英

僵屍獲取錯誤未處理的拒絕錯誤:超時:未能加載此頁面上的所有資源

[英]Zombie getting error Unhandled rejection Error: Timeout: did not get to load all resources on this page

我是僵屍JS的新手。 我想填寫登錄字段並發布登錄表單。 我試圖用zombiejs編寫此代碼,但出現錯誤。

未處理的拒絕錯誤:超時:超時時未加載此頁面上的所有資源(C:\\ Users \\ sapna.maid \\ Desktop \\ nodejs \\ index \\ node_modules \\ zombie \\ lib \\ eventloop.js:601:38) .listOnTimeout(timers.js:92:15)

我的代碼段如下:

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');
    })
});

請幫助我解決此問題。 我在這里呆了很長時間。 提前致謝!

第一個問題是以下聲明失敗,因為www.example.com的標題為Example Domain not Welcome - Sign In

assert.equal(this.browser.text('title'), 'Welcome - Sign In');

此外,這些行很可能也會失敗,因為頁面上沒有具有此類ID的元素。

browser.fill('#user', 'user@example.com');
browser.fill('#pass', 'pass@123');

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM