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

    1. <tfoot id='4Xd2U'></tfoot>
      <i id='4Xd2U'><tr id='4Xd2U'><dt id='4Xd2U'><q id='4Xd2U'><span id='4Xd2U'><b id='4Xd2U'><form id='4Xd2U'><ins id='4Xd2U'></ins><ul id='4Xd2U'></ul><sub id='4Xd2U'></sub></form><legend id='4Xd2U'></legend><bdo id='4Xd2U'><pre id='4Xd2U'><center id='4Xd2U'></center></pre></bdo></b><th id='4Xd2U'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='4Xd2U'><tfoot id='4Xd2U'></tfoot><dl id='4Xd2U'><fieldset id='4Xd2U'></fieldset></dl></div>
        <bdo id='4Xd2U'></bdo><ul id='4Xd2U'></ul>
    2. <small id='4Xd2U'></small><noframes id='4Xd2U'>

        <legend id='4Xd2U'><style id='4Xd2U'><dir id='4Xd2U'><q id='4Xd2U'></q></dir></style></legend>

      1. 在 selenium 中加載包含有用測試功能的外部 js 文件

        Load an external js file containing useful test functions in selenium(在 selenium 中加載包含有用測試功能的外部 js 文件)

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

            • <bdo id='Q5NZW'></bdo><ul id='Q5NZW'></ul>

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

                  <legend id='Q5NZW'><style id='Q5NZW'><dir id='Q5NZW'><q id='Q5NZW'></q></dir></style></legend>
                  本文介紹了在 selenium 中加載包含有用測試功能的外部 js 文件的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  selenium 中的 runScript 命令真的很有用,我用它來匯總表中的值,然后像這樣存儲值

                  The runScript command in selenium is really useful, and I'm using it to total values in a table and then store the value like this

                  <tr>
                      <td>runScript</td>
                      <td>var cumulative = 0.0; $('table.quote-review-group-component').eq(0).find('tr').each( function( i,el ){var singleStackTotal = $(el).find('td').eq(4).html();if( singleStackTotal ){cumulative += parseFloat( singleStackTotal.substring(1) );} }); cumulative = cumulative.toFixed(2)</td>
                      <td></td>
                  </tr>
                  <tr>
                      <td>storeEval</td>
                      <td>selenium.browserbot.getUserWindow().cumulative</td>
                      <td>cumulative</td>
                  </tr>
                  <tr>
                      <td>echo</td>
                      <td>${cumulative}</td>
                  
                      <td></td>
                  </tr>
                  <tr>
                      <td>verifyEquals</td>
                      <td>£${cumulative}</td>
                      <td>${total}</td>
                  </tr>
                  

                  理想情況下,我希望能夠指向外部 js 文件,而不是將命令中的 javascript 作為字符串,這樣我就可以加載一些測試函數并使用 storeEval 來獲取函數的返回

                  Ideally I'd like to be able to point to an external js file rather than have the javascript in the command as a string, so that I can load in some test functions and use storeEval to get the return of the function

                  所以我們有

                  <tr>
                      <td>runExternalScript</td>
                      <td>/path/to/external/extra-tests.js</td>
                      <td></td>
                  </tr>
                  <tr>
                      <td>storeEval</td>
                      <td>selenium.browserbot.getUserWindow().getCumulative(0)</td>
                      <td>cumulative0</td>
                  </tr>
                  <tr>
                      <td>verifyEquals</td>
                      <td>£${cumulative}</td>
                      <td>${total}</td>
                  </tr>
                  

                  外部腳本看起來像這樣

                  function checkSingleGroupListTotal( index ){
                      if ( index == "undefined" ){
                          index = 0;
                      }
                      var cumulative = 0.0; 
                      $('table.quote-review-group-component').eq(index).find('tr').each( function( i,el ){
                          var singleStackTotal = $(el).find('td').eq(4).html();    
                          if( singleStackTotal ){         
                              cumulative += parseFloat( singleStackTotal.substring(1) );     
                          } 
                      }); 
                      return cumulative.toFixed(2);
                  }
                  

                  考慮一個插件,它添加一個 loadScript 動作來檢查外部 js 文件,然后將文件內容傳遞給 runScript 就可以完成這項工作.但我不想重新發明輪子,而且我之前從未構建過插件.

                  Thinking about it a plugin which adds a loadScript action which checks for the external js file and then passes the file contents to runScript would do the job. But I don't want to reinvent the wheel, and I've never built a plug in before.

                  推薦答案

                  runScript 命令只是將包含腳本的 <SCRIPT> 元素添加到 DOM 并讓瀏覽器運行它.你可以自己做同樣的事情,而不是使用內嵌腳本,使用 SRC= 屬性來告訴瀏覽器要加載什么文件.您可能必須從 Web 服務器加載文件,因為某些瀏覽器不允許從網絡加載的頁面訪問 file: URL.

                  The runScript command merely adds a <SCRIPT> element containing the script to the DOM and lets the browser run it. You can do the same yourself, and instead of an in-line script, use the SRC= attribute to tell the browser what file to load. You may have to load the file from a web server, because some browsers won't allow page loaded from the net to access a file: URL.

                  這篇關于在 selenium 中加載包含有用測試功能的外部 js 文件的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  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 - 使用異步數據更新 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 中,如何創建使用 Ionic 組件的自定義指令?)
                  Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(將 ViewChild 用于動態元素 - Angular 2 amp;離子2)

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

                  1. <tfoot id='g96uQ'></tfoot>
                      <tbody id='g96uQ'></tbody>
                  2. <legend id='g96uQ'><style id='g96uQ'><dir id='g96uQ'><q id='g96uQ'></q></dir></style></legend>
                          • <bdo id='g96uQ'></bdo><ul id='g96uQ'></ul>
                            <i id='g96uQ'><tr id='g96uQ'><dt id='g96uQ'><q id='g96uQ'><span id='g96uQ'><b id='g96uQ'><form id='g96uQ'><ins id='g96uQ'></ins><ul id='g96uQ'></ul><sub id='g96uQ'></sub></form><legend id='g96uQ'></legend><bdo id='g96uQ'><pre id='g96uQ'><center id='g96uQ'></center></pre></bdo></b><th id='g96uQ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='g96uQ'><tfoot id='g96uQ'></tfoot><dl id='g96uQ'><fieldset id='g96uQ'></fieldset></dl></div>

                            主站蜘蛛池模板: 欧美日韩在线一区二区三区 | 亚洲精品一区二区 | 男人的天堂久久 | 亚洲高清成人在线 | 爱草在线 | 日韩欧美国产一区二区 | 国产成人一区二区三区 | 成人免费毛片在线观看 | 国产乱码高清区二区三区在线 | 九九久久久 | 欧美色综合| 欧美一级黄色片免费观看 | 一级毛片视频 | 亚洲一区二区三区在线播放 | 中文字幕日本一区二区 | 尤物在线 | 国产精品久久久亚洲 | 美国一级片在线观看 | 黄色在线免费观看视频网站 | av毛片 | 玖玖综合网 | 欧美一区二区三区视频 | 韩国毛片视频 | 在线观看黄视频 | 国产在线观看福利 | 精品国产精品一区二区夜夜嗨 | 亚洲激情一区二区三区 | 欧美一级毛片久久99精品蜜桃 | 狠狠久 | 国产精品久久一区二区三区 | 国产精品综合 | 中文字幕在线观看视频一区 | 久久天堂| 99精品视频免费在线观看 | 久久久久国产精品人 | 精品亚洲视频在线 | 色毛片| 欧美亚洲视频 | 黄毛片| 美女视频黄色的 | 人人澡人人射 |