Angularjs 即使在使用browser.wait()之后,量角器元素也不可见

Angularjs 即使在使用browser.wait()之后,量角器元素也不可见,angularjs,testing,protractor,Angularjs,Testing,Protractor,我正在使用ng hide和ng show作为我的登录页面。测试时,我发现元素不可见,我尝试了browser.wait(),但它显示找到了多个元素 我的代码可在 <div class="login-container"> <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/c3/Python-logo-notext.svg/1024px-Python-logo-notext.svg.p

我正在使用ng hide和ng show作为我的登录页面。测试时,我发现元素不可见,我尝试了browser.wait(),但它显示找到了多个元素

我的代码可在

    <div class="login-container">

    <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/c3/Python-logo-notext.svg/1024px-Python-logo-notext.svg.png"  height="80px" width="80px">

    <!-- Create customer Form -->
      <div class="login-form"  ng-show="signUp">
              <form ng-submit="addUser()">


                <input type="text" placeholder="Name" ng-model="name" required>


                    <input type="email"  placeholder="Email" ng-model="email" required>


                      <input type="password" placeholder="Password" ng-model="password" required>

                  <button  ng-disabled="loading" type="submit" class="button-primary">


                    <span ng-hide="loading">Create</span>
                    <span ng-show="loading">Loading....</span></button>

              </form>

            </div>


        <div class="login-form"   ng-show="login">
            <form ng-submit="signIn()" >


                  <input type="email" placeholder="Email"  ng-model="email" required>

                  <input type="password"  placeholder="Password"  ng-model="password" required>

                <button  ng-disabled="loading" type="submit" class="button-primary">


                  <span ng-hide="loading">Sign In</span>
                  <span ng-show="loading">Loading....</span></button>

            </form>

          </div>


        <!-- Forgot password  -->

         <div class="login-form" ng-show="fp" id="fpass">

           <form ng-submit="forgotPassword()" >


                   <input type="email"  placeholder="Email" ng-model="email" required>


                 <button  ng-disabled="loading" type="submit" class="button-primary">


                   <span ng-hide="loading">Resend</span>
                   <span ng-show="loading">Loading....</span></button>

             </form>

           </div>




             <a href="" id="logIn" ng-click="loginClick()" style="margin-right:5px" ng-hide="login"  >Login </a>
             <a href="" id="signUp"   ng-click="signUpClick()" ng-hide="signUp" style="margin-right:5px">Sign Up </a>

             <a href="" id="forgotPassword"  ng-click="fpClick()" style="margin-right:5px" ng-hide="fp">Forgot Password </a>






        </div>

创造
加载。。。。
登录
加载。。。。
重发
加载。。。。
测试代码

<div class="login-container">

<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/c3/Python-logo-notext.svg/1024px-Python-logo-notext.svg.png"  height="80px" width="80px">

<!-- Create customer Form -->
  <div class="login-form"  ng-show="signUp">
          <form ng-submit="addUser()">


            <input type="text" placeholder="Name" ng-model="name" required>


                <input type="email"  placeholder="Email" ng-model="email" required>


                  <input type="password" placeholder="Password" ng-model="password" required>

              <button  ng-disabled="loading" type="submit" class="button-primary">


                <span ng-hide="loading">Create</span>
                <span ng-show="loading">Loading....</span></button>

          </form>

        </div>


    <div class="login-form"   ng-show="login">
        <form ng-submit="signIn()" >


              <input type="email" placeholder="Email"  ng-model="email" required>

              <input type="password"  placeholder="Password"  ng-model="password" required>

            <button  ng-disabled="loading" type="submit" class="button-primary">


              <span ng-hide="loading">Sign In</span>
              <span ng-show="loading">Loading....</span></button>

        </form>

      </div>


    <!-- Forgot password  -->

     <div class="login-form" ng-show="fp" id="fpass">

       <form ng-submit="forgotPassword()" >


               <input type="email" id="fpass-email" placeholder="Email" ng-model="email" required>


             <button  ng-disabled="loading" type="submit" class="button-primary">


               <span ng-hide="loading">Resend</span>
               <span ng-show="loading">Loading....</span></button>

         </form>

       </div>




         <a href="" id="logIn" ng-click="loginClick()" style="margin-right:5px" ng-hide="login"  >Login </a>
         <a href="" id="signUp"   ng-click="signUpClick()" ng-hide="signUp" style="margin-right:5px">Sign Up </a>

         <a href="" id="forgotPassword"  ng-click="fpClick()" style="margin-right:5px" ng-hide="fp">Forgot Password </a>






    </div>

创造
加载。。。。
登录
加载。。。。
重发
加载。。。。
堆栈跟踪

                   ) Testing User Sign Up, Login and Logout, Forgot password  Test Forgot password and Login
      Message:
        Failed: No element found using locator: By.cssSelector("div[ng-show='fp'].button-primary")
      Stack:
        NoSuchElementError: No element found using locator: By.cssSelector("div[ng-show='fp'].button-primary")
            at process._tickCallback (node.js:368:9)
        Error
            at Object.<anonymous> (/home/leo/python-scripts/Flask-Scaffold/app/templates/users/spec.js:35:57)
        From: Task: Run it(" Test Forgot password and Login") in control flow
        From asynchronous test: 
        Error
            at Suite.<anonymous> (/home/leo/python-scripts/Flask-Scaffold/app/templates/users/spec.js:27:1)
            at Object.<anonymous> (/home/leo/python-scripts/Flask-Scaffold/app/templates/users/spec.js:2:1)

    2 specs, 2 failures
    Finished in 4.807 seconds
    [launcher] 0 instance(s) of WebDriver still running
    [launcher] chrome #1 failed 2 test(s)
    [launcher] overall: 2 failed spec(s)
    [launcher] Process exited with error code 1
)测试用户注册、登录和注销、忘记密码测试忘记密码和登录
信息:
失败:使用定位器By.cssSelector(“div[ng show='fp'].button primary”)未找到任何元素
堆栈:
NoSuchElementError:使用定位器By.cssSelector(“div[ng show='fp'].button primary”)未找到任何元素
在进程中调用(node.js:368:9)
错误

在对象处。

请将代码粘贴到此处以供参考,请参阅常见问题解答:发布测试代码和完整的回溯。所谓测试代码,我指的是您正在执行的javascript+量角器代码。谢谢