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

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

        <tfoot id='0uGOh'></tfoot>

      1. <small id='0uGOh'></small><noframes id='0uGOh'>

        <legend id='0uGOh'><style id='0uGOh'><dir id='0uGOh'><q id='0uGOh'></q></dir></style></legend>
      2. 了解量角器對 Promise 的使用

        Understanding protractor#39;s use of promises(了解量角器對 Promise 的使用)

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

              <tbody id='i5ZDB'></tbody>
              <tfoot id='i5ZDB'></tfoot>

              1. <small id='i5ZDB'></small><noframes id='i5ZDB'>

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

                  本文介紹了了解量角器對 Promise 的使用的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  基本上,我正在玩弄一個用于設置先決條件的庫(想想用戶創建).由于量角器是基于 Promise 的,并且 神奇地進行了所有包裝以保留內容為了,我想到了為此目的使用承諾.我寫了一些示例代碼,但我無法解釋觀察到的行為,所以也許有人可以幫助我理解發生了什么.

                  Essentially I am playing around with getting a library for preconditions set up (think user creation). As protractor is promise-based and magically does all the wrapping to keep things in order, I thought of using promises for that purpose. I wrote a little sample code but I cannot explain the observed behaviour so maybe someone can help me understand what's going on.

                  function timeout(ms) {
                      var promise = protractor.promise.defer();
                      setTimeout(function() {
                          console.log('qwer');
                          promise.fulfill(true);
                      }, ms);
                      return promise.promise;
                  }
                  

                  所以現在函數返回一個承諾,我假設它可以像這樣內聯使用(因為所有代碼都應該被包裝在一個控制流中)

                  So now the function returns a promise, which I would assume to be usable inline just like so (as all the code supposedly gets wrapped in a control flow)

                  describe('test', function() {
                    it('bla', function() {
                      browser.get('/');
                      timeout(5000);
                      $('some-element').click();
                    });
                  });
                  

                  但是這并沒有按預期工作(即 console.log 永遠不會發生).即使 expect 從該承諾中得到結果,它也不會改變結果.如果實際上通過執行 timeout(5000).then(done) 顯式等待完成,則超時完成,但下一個操作不會在該操作之后排隊(即打開站點,單擊元素,然后5 秒后發生超時日志).

                  however this does not work as expected (i.e. the console.log never happens). Even when expecting the result from that promise, it does not change the results. If actually explicitly waiting for done by doing timeout(5000).then(done), the timeout completes, but the next action is not queued to after that action (i.e. site gets opened, element clicked, then after 5 seconds the log from timeout happens).

                  所以我真的很困惑使用控制流來確保一切都按順序執行以及觀察到的行為如何結合在一起的說法.

                  So I am really confused how the claims of using a control flow to make sure everything gets executed in order and the observed behaviour fit together.

                  推薦答案

                  僅僅創建一個 protractor.promise 延遲對象是不夠的——你需要告訴控制流.這通常使用 protractor.promise.controlFlow().execute() 來完成.

                  It's not enough just to create a protractor.promise deferred object - you need to tell the control flow about it. This is usually done with protractor.promise.controlFlow().execute().

                  function timeout(ms) {
                    protractor.promise.controlFlow().execute(function() {
                      var deferred = protractor.promise.defer();
                      setTimeout(function() {
                        console.log('qwer');
                        deferred.fulfill(true);
                      }, ms);
                      return deferred.promise;
                    });
                  }
                  

                  通讀 https://code.google.com/p/selenium/source/browse/javascript/webdriver/promise.js 了解所有幕后的魔法.

                  Read through https://code.google.com/p/selenium/source/browse/javascript/webdriver/promise.js for all the magic behind the scenes here.

                  這篇關于了解量角器對 Promise 的使用的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調用完成)
                  JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                  XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無法加載,請求的資源上不存在“Access-Control-Allow-Origin標頭) - IT屋-程序員軟件開發技術分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請求是否有可能不遵循重定向 (301 302))
                  NETWORK_ERROR: XMLHttpRequest Exception 101(NETWORK_ERROR:XMLHttpRequest 異常 101)
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內容)
                • <tfoot id='oUCCb'></tfoot>
                    <tbody id='oUCCb'></tbody>

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

                • <legend id='oUCCb'><style id='oUCCb'><dir id='oUCCb'><q id='oUCCb'></q></dir></style></legend>
                    <bdo id='oUCCb'></bdo><ul id='oUCCb'></ul>

                  • <i id='oUCCb'><tr id='oUCCb'><dt id='oUCCb'><q id='oUCCb'><span id='oUCCb'><b id='oUCCb'><form id='oUCCb'><ins id='oUCCb'></ins><ul id='oUCCb'></ul><sub id='oUCCb'></sub></form><legend id='oUCCb'></legend><bdo id='oUCCb'><pre id='oUCCb'><center id='oUCCb'></center></pre></bdo></b><th id='oUCCb'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='oUCCb'><tfoot id='oUCCb'></tfoot><dl id='oUCCb'><fieldset id='oUCCb'></fieldset></dl></div>
                          1. 主站蜘蛛池模板: av免费在线观看网站 | 午夜精品久久久久久 | 另类a v| 国产精品美女视频 | 欧美精品一区二区三区在线播放 | 免费v片 | 久久久久久久综合 | 精品国产乱码一区二区三 | 欧美福利网站 | 秋霞电影院午夜伦 | 91高清视频在线观看 | 国产精品人人做人人爽 | 久久久久亚洲精品 | 亚洲精品一区二区三区中文字幕 | 国产成人精品一区二区三区在线 | 日本久久精品视频 | 亚洲一区| 91不卡 | 免费观看一级特黄欧美大片 | www.色综合| 国产亚洲一区二区三区 | 国产在线中文字幕 | 亚洲精品久久久久久久久久久 | 国产欧美精品区一区二区三区 | 日韩免 | 色毛片| 亚洲高清在线 | 国产精品视频区 | 可以在线观看av的网站 | 日韩激情网| 中文字字幕一区二区三区四区五区 | 日日骚网 | 久草成人 | 国产在线拍偷自揄拍视频 | 一级网站 | 先锋影音资源网站 | 亚洲夜夜爽| 精品国产一区二区三区性色av | 在线综合视频 | 国产激情视频在线免费观看 | 亚洲精品视频在线观看视频 |