目前我正在尝试使用zombie.js 为我的网站运行自动化测试。现在我正在努力使一个人注册自动化。对于注册,表单与 3 个不同的 div 一起使用,如下所示
页面代码:
<form>
   <div id=step1>
   <div id=step2>
   <div id=step3> 
</form> 
...
...
<button id="nextStep" class="btn btn-primary" role="button" 
   onClick="signupNext()">Cnt. </button>
SignupNext 是一个 javascript 函数,它禁用按钮,然后进行一些简单的操作,然后重新启用按钮。
僵尸代码:
browser
   .visit(https://example.com, function(){
     browser.fill(....)
     browser.fill(....)
     browser.pressButton('#nextStep', function(){
        browser.fill(...)
        browser.fill(...)
        browser.pressButton('#nextStep', function(){ //THIS LINE Errors
            ...
            ...
        });
     });
   })
Zombie 在第二个 .pressButton 上抛出错误“按钮已禁用”。就我对zombiejs 的理解而言,在我看来,pressButton 应该等待事件完成然后执行回调函数。
*zombiejs 的新手