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

  • <small id='MH9FX'></small><noframes id='MH9FX'>

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

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

        <tfoot id='MH9FX'></tfoot>
        <legend id='MH9FX'><style id='MH9FX'><dir id='MH9FX'><q id='MH9FX'></q></dir></style></legend>

        在量角器中正確使用頁面對象模式

        Using Page Object Pattern Correctly in Protractor(在量角器中正確使用頁面對象模式)

            <bdo id='bHfke'></bdo><ul id='bHfke'></ul>
                <tbody id='bHfke'></tbody>

                <tfoot id='bHfke'></tfoot>

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

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

                  <legend id='bHfke'><style id='bHfke'><dir id='bHfke'><q id='bHfke'></q></dir></style></legend>
                  本文介紹了在量角器中正確使用頁面對象模式的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我有一個 Angular 應用程序,我正在使用 Protractor 對其進行測試.

                  HTML

                   <div id="all" class="row text-center"><div class="col-lg-4 col-md-4 col-sm-6 col-xs-6"><div class="dashboard-stat block panel padder-v bg-primary"><div class="icon hidden-xs"><img src="../assets/images/icon-ppt-inv.png"></div>

                  <div id="value" class="font-thin h1 block">{{summary.num |號碼:0}}</div><div id="name" class="text-muted text-xs">阿爾伯特</div></div></div></div></div>

                  這是頁面對象的代碼:

                   '使用嚴格';var history_page = function (){this.getStat = 函數(){return element.all(by.css('#all'));};this.getName = 函數(){return element(by.css('#name')).getText();};this.getValue = 函數(){return element(by.css('#value')).getText();};};module.exports = new history_page();

                  測試代碼

                   var historyPage = require('./history_page.js');它('測試',函數(){var history = historyPage.getStat().map(function (stat) {返回 {名稱:stat.historyPage.getName()值:stat.historyPage.getValue(),}});history.then(函數(值){控制臺.log(值);});});

                  由于某種原因,我不斷收到錯誤消息,提示 getName 未定義.如果我更改以下兩行

                  名稱:stat.historyPage.getName()值:stat.historyPage.getValue(),

                  作為

                  name: stat.element(by.css('#name')).getText(),值:stat.element(by.css('#value')).getText()

                  它工作正常.我不確定是什么原因.我真的想避免在我的測試頁面上編寫 css 定位器,因為它看起來不太好,而且這是一種不好的做法.我會感謝對我有幫助的建議.

                  解決方案

                  我會將完整的 map() 塊移動到頁面對象中:

                  var history_page = function () {this.all = element.all(by.css('#all'));this.getStat = function() {返回 this.all.map(function (stat) {返回 {名稱:stat.element(by.css('#name')).getText(),值:stat.element(by.css('#value')).getText()}});};};module.exports = new history_page();

                  I have an Angular app and I am using Protractor to test it.

                  HTML

                   <div id="all" class="row text-center">
                          <div class="col-lg-4 col-md-4 col-sm-6 col-xs-6">
                            <div class="dashboard-stat block panel padder-v bg-primary">
                              <div class="icon hidden-xs">
                                <img src="../assets/images/icon-ppt-inv.png">
                              </div>
                              <div>
                                <div id="value" class="font-thin h1 block">
                                  {{summary.num | number:0}}
                                </div>
                                <div id="name" class="text-muted text-xs">
                                  Albert
                                </div>
                              </div>
                            </div>
                          </div>
                          </div>
                  

                  Here is the code for the Page Object:

                      'use strict';
                  
                          var history_page = function (){
                  
                              this.getStat = function(){
                                  return element.all(by.css('#all'));
                              };
                  
                              this.getName = function(){
                                  return element(by.css('#name')).getText();
                              };
                  
                              this.getValue = function(){
                                  return element(by.css('#value')).getText();
                              };
                  
                  
                          };
                  
                          module.exports = new history_page();
                  

                  Test Code

                   var historyPage = require('./history_page.js');
                  
                      it('Test', function(){
                  
                  
                       var history = historyPage.getStat().map(function (stat) {
                          return {
                              name: stat.historyPage.getName()
                              value: stat.historyPage.getValue(),
                          }
                      });
                  
                       history.then(function (value) {
                          console.log(value);
                      });
                  
                  
                       });
                  

                  For some reason I keep getting an error saying getName is not defined. If I change the following two lines

                  name: stat.historyPage.getName() 
                  value: stat.historyPage.getValue(),
                  

                  as

                  name: stat.element(by.css('#name')).getText(),
                  value: stat.element(by.css('#value')).getText()
                  

                  It works fine. I am not sure what the reason is. I really want to avoid writing css locators on my test page as it does not look good and it is a bad practice. I will appreciate suggestions to help me.

                  解決方案

                  I would move the complete map() block into the Page Object:

                  var history_page = function () {
                      this.all = element.all(by.css('#all'));
                  
                      this.getStat = function() {
                          return this.all.map(function (stat) {
                              return {
                                  name: stat.element(by.css('#name')).getText(),
                                  value: stat.element(by.css('#value')).getText()
                              }
                          });
                      };
                  };
                  
                  module.exports = new history_page();
                  

                  這篇關于在量角器中正確使用頁面對象模式的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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() 的限制?)

                1. <legend id='owi0p'><style id='owi0p'><dir id='owi0p'><q id='owi0p'></q></dir></style></legend>
                    <bdo id='owi0p'></bdo><ul id='owi0p'></ul>
                            <tbody id='owi0p'></tbody>

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

                          • <tfoot id='owi0p'></tfoot>

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

                            主站蜘蛛池模板: 日韩中文字幕在线观看 | 久久久www成人免费精品 | 久久国产欧美日韩精品 | 国产日产久久高清欧美一区 | 亚洲免费av一区 | 免费色网址 | 久久久国产精品一区 | 国产精品成人在线观看 | 午夜电影网站 | 国产在线播放一区二区三区 | 91在线视频免费观看 | 黄色片在线观看网址 | 国产精品精品视频一区二区三区 | 97国产一区二区精品久久呦 | 中文字幕亚洲精品 | 国产精品一区二区三区在线 | 日韩欧美一区二区三区在线播放 | 91高清在线观看 | 欧美日韩精品亚洲 | 国产日韩av一区二区 | 国内精品久久影院 | 午夜视频在线 | 亚洲精品久久 | 一级黄色片免费在线观看 | 亚州精品天堂中文字幕 | 精品国产乱码久久久 | 欧美成人免费在线视频 | 亚洲视频一区二区三区四区 | 精品麻豆剧传媒av国产九九九 | 日本精品一区二区三区在线观看视频 | 激情五月综合 | 老外黄色一级片 | 亚洲欧美日韩在线一区二区 | 日韩成人在线免费视频 | 91麻豆精品国产91久久久久久久久 | 91精品国产综合久久精品 | 久久婷婷av| 免费av手机在线观看 | 色婷婷综合在线观看 | 精品视频导航 | 国产成人免费在线观看 |