<tfoot id='c8BZ5'></tfoot>
    <bdo id='c8BZ5'></bdo><ul id='c8BZ5'></ul>
<legend id='c8BZ5'><style id='c8BZ5'><dir id='c8BZ5'><q id='c8BZ5'></q></dir></style></legend>

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

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

    2. 量角器 - 如何将一组承诺的结果放入另一个数组

      时间:2023-06-15
    3. <i id='gsjC4'><tr id='gsjC4'><dt id='gsjC4'><q id='gsjC4'><span id='gsjC4'><b id='gsjC4'><form id='gsjC4'><ins id='gsjC4'></ins><ul id='gsjC4'></ul><sub id='gsjC4'></sub></form><legend id='gsjC4'></legend><bdo id='gsjC4'><pre id='gsjC4'><center id='gsjC4'></center></pre></bdo></b><th id='gsjC4'></th></span></q></dt></tr></i><div id='gsjC4'><tfoot id='gsjC4'></tfoot><dl id='gsjC4'><fieldset id='gsjC4'></fieldset></dl></div>
        <tbody id='gsjC4'></tbody>
        <legend id='gsjC4'><style id='gsjC4'><dir id='gsjC4'><q id='gsjC4'></q></dir></style></legend>

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

          <tfoot id='gsjC4'></tfoot>

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

                问题描述

                我从这段代码中得到了一系列承诺: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]);
                    }
                });
                

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

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

                相关文章

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

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

                1. <legend id='cA2t8'><style id='cA2t8'><dir id='cA2t8'><q id='cA2t8'></q></dir></style></legend>

                  1. <tfoot id='cA2t8'></tfoot>

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