2016-11-07 43 views
0

我想登錄在我的Wordpress網站,但似乎登錄無法成功。如何使用zombie.js登錄到WordPress的管理員?

describe('Administrator', function(){ 
    const browser = new Browser(); 
    this.timeout(10000); 
    before(function() { 
     return browser.visit(baseUrl+'wp-login.php'); 
    }); 

    it('Login into wp-admin', function(done){ 
     browser.fill('#user_login', 'my_username') 
       .fill('#user_pass', 'my_password') 
       .pressButton('#wp-submit', 
     function(){ 
      console.log(browser.text('title')); // My Wordpress ‹ Log In 
      //browser.assert.element('body.wp-admin'); 
      //done(); 
     }); 
    }); 

    after(function() { 
     browser.destroy(); 
    }); 
}); 

當我做記錄由browser.text('title')

其返回我的WordPress <登錄沒有控制檯<我的WordPress

這意味着它不會成功。我嘗試用wait()then()setTimeout()檢查之前,所以它的錯誤,如:

Error: timeout of 10000ms exceeded. Ensure the done() callback is being called in this test.

任何想法?

回答

1

我試圖通過對https://demos1.softaculous.com/WordPress/wp-login.php運行您的示例代碼來重現您的問題。我看到殭屍在100%的時候試圖在頁面上找到可見/隱藏的元素。

我打開並修復了https://github.com/assaf/zombie/issues/1086,以顯着提高該特定WordPress網站上殭屍的性能。

您應該再次嘗試使用殭屍> 5.0.2來查看您的WordPress網站是否導致相同的高CPU行爲。

+0

感謝您的修復! – l2aelba