久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <tfoot id='ZjdkC'></tfoot>

  • <i id='ZjdkC'><tr id='ZjdkC'><dt id='ZjdkC'><q id='ZjdkC'><span id='ZjdkC'><b id='ZjdkC'><form id='ZjdkC'><ins id='ZjdkC'></ins><ul id='ZjdkC'></ul><sub id='ZjdkC'></sub></form><legend id='ZjdkC'></legend><bdo id='ZjdkC'><pre id='ZjdkC'><center id='ZjdkC'></center></pre></bdo></b><th id='ZjdkC'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ZjdkC'><tfoot id='ZjdkC'></tfoot><dl id='ZjdkC'><fieldset id='ZjdkC'></fieldset></dl></div>

        <bdo id='ZjdkC'></bdo><ul id='ZjdkC'></ul>

      <small id='ZjdkC'></small><noframes id='ZjdkC'>

      <legend id='ZjdkC'><style id='ZjdkC'><dir id='ZjdkC'><q id='ZjdkC'></q></dir></style></legend>

        量角器,我什么時候應(yīng)該在 click() 之后使用 the

        Protractor, when should I use then() after a click()(量角器,我什么時候應(yīng)該在 click() 之后使用 then())
          <i id='7QQjh'><tr id='7QQjh'><dt id='7QQjh'><q id='7QQjh'><span id='7QQjh'><b id='7QQjh'><form id='7QQjh'><ins id='7QQjh'></ins><ul id='7QQjh'></ul><sub id='7QQjh'></sub></form><legend id='7QQjh'></legend><bdo id='7QQjh'><pre id='7QQjh'><center id='7QQjh'></center></pre></bdo></b><th id='7QQjh'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='7QQjh'><tfoot id='7QQjh'></tfoot><dl id='7QQjh'><fieldset id='7QQjh'></fieldset></dl></div>

            <bdo id='7QQjh'></bdo><ul id='7QQjh'></ul>
          • <tfoot id='7QQjh'></tfoot>
          • <small id='7QQjh'></small><noframes id='7QQjh'>

            <legend id='7QQjh'><style id='7QQjh'><dir id='7QQjh'><q id='7QQjh'></q></dir></style></legend>
              <tbody id='7QQjh'></tbody>
                1. 本文介紹了量角器,我什么時候應(yīng)該在 click() 之后使用 then()的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我正在運行一個 Angular 應(yīng)用程序,當(dāng)在量角器上測試 click() 時,我不知道何時應(yīng)該使用 then() 解決承諾.

                  I'm running an Angular app and when testing on protractor a click(), I don't know when should I resolve the promise with a then().

                  我在 Protractor API 上找到了這個:

                  I found this on Protractor API:

                  當(dāng)點擊命令完成時將被解決的承諾.

                  A promise that will be resolved when the click command has completed.

                  那么,我應(yīng)該在每次 click 中使用 click().then() 嗎?

                  So, should I use click().then() in every click?

                  推薦答案

                  那么,我應(yīng)該在每次點擊中使用 click().then() 嗎?

                  So, should I use click().then() in every click?

                  絕對不是.

                  不需要,因為 Protractor/WebDriverJS 有這種稱為 " 的機制控制流",它基本上是一個需要解決的承諾隊列:

                  It's not needed because Protractor/WebDriverJS has this mechanism called "Control Flow" which is basically a queue of promises that need to be resolved:

                  WebDriverJS 維護一個待處理的 Promise 隊列,稱為控件流,以保持執(zhí)行有條理.

                  WebDriverJS maintains a queue of pending promises, called the control flow, to keep execution organized.

                  并且 Protractor 會自然地、開箱即用地等待 Angular:

                  and Protractor waits for Angular naturally and out-of-the-box:

                  您不再需要在測試中添加等待和睡眠.量角器可以在測試的那一刻自動執(zhí)行下一步網(wǎng)頁完成待處理任務(wù),您無需擔(dān)心等待您的測試和網(wǎng)頁同步.

                  You no longer need to add waits and sleeps to your test. Protractor can automatically execute the next step in your test the moment the webpage finishes pending tasks, so you don’t have to worry about waiting for your test and webpage to sync.

                  這導(dǎo)致了一個非常直接的測試代碼:

                  Which leads to a quite straight-forward testing code:

                  var elementToBePresent = element(by.css(".anotherelementclass")).isPresent();
                  
                  expect(elementToBePresent.isPresent()).toBe(false);
                  element(by.css("#mybutton")).click();
                  expect(elementToBePresent.isPresent()).toBe(true);
                  

                  <小時>

                  但有時,如果您遇到同步/計時問題,或者您的被測應(yīng)用不是 Angular,您可以通過使用 then()<顯式解析 click() 來解決它/code> 并在點擊回調(diào)中繼續(xù):


                  Sometimes though, if you experience synchronization/timing issues, or your app under test is non-Angular, you may solve it by resolving the click() explicitly with then() and continue inside the click callback:

                  expect(elementToBePresent.isPresent()).toBe(false);
                  element(by.css("#mybutton")).click().then(function () {
                      expect(elementToBePresent.isPresent()).toBe(true);
                  });
                  

                  還有顯式等待在這些情況下的救援,但在這里不相關(guān).

                  There are also Explicit Waits to the rescue in these cases, but it's not relevant here.

                  這篇關(guān)于量角器,我什么時候應(yīng)該在 click() 之后使用 then()的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Use IScroll in Angular 2 / Typescript(在 Angular 2/Typescript 中使用 IScroll)
                  anime.js not working in Ionic 3 project(Anime.js 在 Ionic 3 項目中不起作用)
                  Ionic 3 - Update Observable with Asynchronous Data(Ionic 3 - 使用異步數(shù)據(jù)更新 Observable)
                  Angular 2: file not found on local .json file(Angular 2:在本地 .json 文件中找不到文件)
                  In Ionic 2, how do I create a custom directive that uses Ionic components?(在 Ionic 2 中,如何創(chuàng)建使用 Ionic 組件的自定義指令?)
                  Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(將 ViewChild 用于動態(tài)元素 - Angular 2 amp;離子2)

                  <i id='NVIvg'><tr id='NVIvg'><dt id='NVIvg'><q id='NVIvg'><span id='NVIvg'><b id='NVIvg'><form id='NVIvg'><ins id='NVIvg'></ins><ul id='NVIvg'></ul><sub id='NVIvg'></sub></form><legend id='NVIvg'></legend><bdo id='NVIvg'><pre id='NVIvg'><center id='NVIvg'></center></pre></bdo></b><th id='NVIvg'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='NVIvg'><tfoot id='NVIvg'></tfoot><dl id='NVIvg'><fieldset id='NVIvg'></fieldset></dl></div>

                  <tfoot id='NVIvg'></tfoot>

                  <small id='NVIvg'></small><noframes id='NVIvg'>

                      <tbody id='NVIvg'></tbody>
                    • <bdo id='NVIvg'></bdo><ul id='NVIvg'></ul>

                        1. <legend id='NVIvg'><style id='NVIvg'><dir id='NVIvg'><q id='NVIvg'></q></dir></style></legend>
                          • 主站蜘蛛池模板: 国产japanhdxxxx麻豆 | 国产在线资源 | 午夜精品一区二区三区在线视 | 国产精品美女久久久久久免费 | 特黄毛片| aaa在线| 午夜影院操 | 天天看片天天干 | 欧美日韩综合视频 | 亚洲国产一区二区视频 | 成人免费区一区二区三区 | 欧美国产精品 | 六月婷婷久久 | 国产一区二区三区免费 | 一级h片 | 成人av免费 | 欧美啪啪 | 国产成人精品久久二区二区 | 成人国产免费观看 | 欧美一级免费黄色片 | 韩日一区 | 欧美日韩亚洲国产 | 欧美一区精品 | 成年人黄色一级毛片 | 精品一区av | 毛片在线免费 | 国产精品久久久久久中文字 | 天天操网 | 久久精品亚洲国产 | 91视频网址 | 91成人免费看 | 国产高清一区二区三区 | 一区二区国产在线 | 精品在线99| 在线欧美亚洲 | 99亚洲 | 91精品久久久久久久久久小网站 | 日韩精品一区二区三区中文在线 | 亚洲在线一区二区 | 人人精品| 久久伊人免费视频 |