<tfoot id='wuJrU'></tfoot>

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

    1. <i id='wuJrU'><tr id='wuJrU'><dt id='wuJrU'><q id='wuJrU'><span id='wuJrU'><b id='wuJrU'><form id='wuJrU'><ins id='wuJrU'></ins><ul id='wuJrU'></ul><sub id='wuJrU'></sub></form><legend id='wuJrU'></legend><bdo id='wuJrU'><pre id='wuJrU'><center id='wuJrU'></center></pre></bdo></b><th id='wuJrU'></th></span></q></dt></tr></i><div id='wuJrU'><tfoot id='wuJrU'></tfoot><dl id='wuJrU'><fieldset id='wuJrU'></fieldset></dl></div>
        <bdo id='wuJrU'></bdo><ul id='wuJrU'></ul>

    2. <legend id='wuJrU'><style id='wuJrU'><dir id='wuJrU'><q id='wuJrU'></q></dir></style></legend>
      1. 量角器 - 如何将一组承诺的结果放入另一个数组

        时间:2023-10-12
      2. <tfoot id='zQPCx'></tfoot>
        <i id='zQPCx'><tr id='zQPCx'><dt id='zQPCx'><q id='zQPCx'><span id='zQPCx'><b id='zQPCx'><form id='zQPCx'><ins id='zQPCx'></ins><ul id='zQPCx'></ul><sub id='zQPCx'></sub></form><legend id='zQPCx'></legend><bdo id='zQPCx'><pre id='zQPCx'><center id='zQPCx'></center></pre></bdo></b><th id='zQPCx'></th></span></q></dt></tr></i><div id='zQPCx'><tfoot id='zQPCx'></tfoot><dl id='zQPCx'><fieldset id='zQPCx'></fieldset></dl></div>

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

          • <legend id='zQPCx'><style id='zQPCx'><dir id='zQPCx'><q id='zQPCx'></q></dir></style></legend>

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

                    <tbody id='zQPCx'></tbody>
                • 本文介绍了量角器 - 如何将一组承诺的结果放入另一个数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我从这段代码中得到了一系列承诺:element.all(by.repeater('unit in units')),我发现很难将数据放入另一个数组:

                  I got an array of promises from this code: element.all(by.repeater('unit in units')), and I am finding it really difficult to get the data into another array:

                  element.all(by.repeater('unit in units')).then(function (arr) {
                      var items = [];
                  
                      for (var i = 0; i < arr.length; i++) {
                        arr[i].getText().then(function(text) {
                          items.push(text);
                        });
                      }
                  
                     //PROBLEM ITEMS is Empty
                     console.log(items);
                  });
                  

                  推荐答案

                  设法以更简单的方式获得相同的结果,避免使用 Q 和中继器.使用内置地图就可以了.

                  Managed to get the same result on a simpler way avoiding using Q and the repeater. Using the inbuilt map does the trick.

                  var tabs = element.all(by.css('.unitTabs li a')).map(function (elm) {
                      return elm.getText();
                  });
                  
                  tabs.then(function (result) {
                      var sorted = _.sortBy(result, function (name) { return name; });
                      for (var i = 0; i < result.length; i++) {
                          expect(result[i]).toBe(sorted[i]);
                      }
                  });
                  

                  这篇关于量角器 - 如何将一组承诺的结果放入另一个数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:有/没有硒的差异运行量角器? 下一篇:使用 $resource 时量角器超时等待与页面同步

                  相关文章

                  最新文章

                • <legend id='K4tW1'><style id='K4tW1'><dir id='K4tW1'><q id='K4tW1'></q></dir></style></legend>

                  <tfoot id='K4tW1'></tfoot>
                    • <bdo id='K4tW1'></bdo><ul id='K4tW1'></ul>

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

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