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

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

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

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

        量角器 - 查找所有元素和找到的元素的循環長度

        Protractor - Find all elements and loop length of found elements and click button(量角器 - 查找所有元素和找到的元素的循環長度并單擊按鈕)
        • <small id='swZ7w'></small><noframes id='swZ7w'>

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

                  <tbody id='swZ7w'></tbody>
                • <bdo id='swZ7w'></bdo><ul id='swZ7w'></ul>
                • <legend id='swZ7w'><style id='swZ7w'><dir id='swZ7w'><q id='swZ7w'></q></dir></style></legend>
                  本文介紹了量角器 - 查找所有元素和找到的元素的循環長度并單擊按鈕的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  所以我一直試圖弄清楚如何根據 find All 元素的數量單擊按鈕 x 次.這意味著如果有 3 個元素由相同的類名找到,那么我們循環 3 次,應該點擊按鈕 3 次.

                  So I have been trying to figure out on how to click a button x times depending on how many find All elements are. Meaning if there is 3 elements that is found by the same classname then we loop 3 times which should click the button 3 times.

                  我做過這樣的事情:

                  (新的更新,檢查底部的編輯帖子)

                  通常 element.all(by.className('btn btn-remove btn-outlined')).getText() 是 3 但可以更改為 6 和隨機數所以我的想法是首先閱讀 HTML 中有多少 btn btn-remove btn-outlined 并單擊多次找到的元素.因此,如果找到 3 個,則單擊該按鈕 3 次.

                  Usually the element.all(by.className('btn btn-remove btn-outlined')).getText() is 3 but can be changed to 6 and random numbers so my idea was to read first how many btn btn-remove btn-outlined are in the HTML and click that many times of found elements. So if 3 found then click the button 3 times.

                  但是現在的問題是它要找到有多少元素.它也循環了很多次,以 text.length 給出,但在循環內部,由于某些原因,它似乎跳過了 it 函數,我不知道為什么

                  However the problem right now is that it is finding how many elements there are. It is also looping that many times that is given as text.length but inside the loop it seems to skip the it functions for some reasons and I cant figure out why

                  現在它確實找到了 3 個元素的長度,它似乎循環了很多次,但它跳過了它的功能(這部分):

                  Right now it does find the length of the elements which is 3 and it seems to loop that many times but it skips to do the it functions (This part):

                        it('Click remove button - ' + i + '/' + text.length, function (done) {
                  
                              browser.driver
                                  .then(() => browser.executeScript("arguments[0].click();", element.all(by.className('btn btn-remove btn-outlined').first().getWebElement())));
                                  .then(() => done());
                          });
                  
                          it('Wait for fading button to be gone', function (done) {
                  
                              setTimeout(function () {
                                  done();
                              }, 1000);
                  
                          });
                  

                  我很害怕我可能做錯了我不知道的事情.

                  and I am afarid that I might have done something wrong that I am not aware of.

                  如何找到 DOM 中有多少給定元素并循環多次 + 單擊刪除按鈕?

                  How can I find how many given elements are in the DOM and loop that many times + click the remove button?

                  編輯代碼:

                  it('Click remove button', function (done) {
                  
                      element.all(by.className('btn btn-remove btn-outlined')).getText().then(function (text) {
                          console.log(text.length) //returns 3
                          for (var i = 0; i < 4; i++) {
                  
                              console.log(i); //Does print 0 1 2
                  
                              it('Click remove button - ' + i + '/' + text.length, function (done) {
                  
                                  console.log("Remove button"); //Doesnt print
                  
                                  browser.driver
                                      .then(() => browser.executeScript("arguments[0].click();", element.all(by.className('btn btn-remove btn-outlined').first().getWebElement())));
                                      .then(() => done());
                              });
                  
                              it('Wait for fading button to be gone', function (done) {
                  
                                  console.log("TIme out"); //Doesnt print
                  
                                  setTimeout(function () {
                                      done();
                                  }, 1000);
                  
                              });
                          }
                      })
                      done();
                  });
                  

                  推薦答案

                  你的it里面的for循環沒有執行的原因是那些it在運行時動態生成的,沒有受到測試框架 Jasmine、Mocha 的尊重.

                  The reason of your it inside for loop not executed is those it generated dynamically in run time and did not respected by the test framework, Jasmine, Mocha.

                  據我所知,Jasmine 在執行測試腳本文件之前需要加載和解析靜態 it,在加載和解析階段生成的動態 it 將被忽略.因此,您需要刪除動態 it.

                  As I learned, Jasmine need to load and parse the static it in test script files before executing them, dynamic it generated behind the load and parse stage will be ignored. Thus you need remove dynamic it.

                  試試下面的代碼

                  it('Click remove button', function (done) {
                  
                      let allBtns = element.all(by.className('btn btn-remove btn-outlined'));
                  
                      allBtns.count()
                      .then(function (cnt) {
                  
                          console.log('Find buttons:', cnt)
                  
                          for (let i = 0; i < cnt; i++) { // important to use let but var here.
                              console.log('Remove button - ' + i + '/' + cnt);
                              browser.executeScript("arguments[0].click();", allBtns.get(i).getWebElement())
                              browser.sleep(1000) // sleep 1s
                          }
                      })
                      .then(()=>{
                          done();
                      })
                  
                  });
                  

                  這篇關于量角器 - 查找所有元素和找到的元素的循環長度并單擊按鈕的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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))
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內容)
                  Restrictions of XMLHttpRequest#39;s getResponseHeader()?(XMLHttpRequest 的 getResponseHeader() 的限制?)
                        <i id='S9B3K'><tr id='S9B3K'><dt id='S9B3K'><q id='S9B3K'><span id='S9B3K'><b id='S9B3K'><form id='S9B3K'><ins id='S9B3K'></ins><ul id='S9B3K'></ul><sub id='S9B3K'></sub></form><legend id='S9B3K'></legend><bdo id='S9B3K'><pre id='S9B3K'><center id='S9B3K'></center></pre></bdo></b><th id='S9B3K'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='S9B3K'><tfoot id='S9B3K'></tfoot><dl id='S9B3K'><fieldset id='S9B3K'></fieldset></dl></div>

                        <legend id='S9B3K'><style id='S9B3K'><dir id='S9B3K'><q id='S9B3K'></q></dir></style></legend>
                          <tbody id='S9B3K'></tbody>

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

                            <bdo id='S9B3K'></bdo><ul id='S9B3K'></ul>
                          • <tfoot id='S9B3K'></tfoot>
                          • 主站蜘蛛池模板: 在线免费国产视频 | 成年免费大片黄在线观看一级 | 国产精品海角社区在线观看 | 日韩三级电影在线看 | 日韩喷潮 | 欧美日韩中文字幕 | 91成人在线视频 | 国产乱码精品一区二区三区忘忧草 | 久久久久国色av免费观看性色 | 国产色| 欧美在线视频一区二区 | 欧美又大粗又爽又黄大片视频 | 国产精品网页 | 欧美一级免费 | 亚洲色图综合 | 亚洲视频免费在线播放 | 欧美在线 | 色播视频在线观看 | 日韩伦理一区二区 | 91porn在线 | 九九天堂网 | 中文字幕在线第二页 | 超碰伊人 | 欧美精品一区二区蜜桃 | 亚洲天堂久久新 | 国产一区二区视频免费在线观看 | 日韩在线精品强乱中文字幕 | 日日夜夜精品免费视频 | 亚洲第一福利视频 | 久久久久久久久久久久久9999 | 日本午夜免费福利视频 | 午夜一区二区三区 | 天堂网av在线 | 久久久久成人精品 | 久久美女网 | 久久精品欧美一区二区三区不卡 | 日本精品一区二区三区视频 | 狠狠干夜夜草 | 狠狠操狠狠干 | 国产精品入口麻豆www | 日本成人三级电影 |