2016-12-12 8 views
0

私は1つのウェブサイトをテストしようとしていますhttp://www.way2automation.com/angularjs-protractor/banking/#/customer これは1つのドロップダウンリストで、私はロケータby.repeater、by.model、getTextを試してみましたが、テストの実行に失敗しました。分度器のng-repeat内の要素を見つけるにはどうすればよいですか?

私の仕様とpageObjectのコードを添付しています。

のPageObject - など

var CustomerLoginPage = function() { 

    this.login1 = element(by.buttonText("Login")); 
    this.select=element(by.repeater('cust in Customers')); 

    this.getCustomer = function() { 
     select.getText(); 
    } 

    this.showLogin = function() { 
     login1.click(); 
    }; 
}; 
module.exports = CustomerLoginPage; 

スペックファイル

describe("Customer Login Functionality" , function() { 

    browser.sleep(1000); 
    it("name details",function() { 
     browser.get('http://www.way2automation.com/angularjs-protractor/banking/#'); 
     // customer.setName(); 
     expect(customer.getCustomer()).toEqual('Harry Porter'); 
     browser.sleep(1000); 
    }); 

    it("show" ,function() { 

     customer.showLogin(); 
     browser.sleep(1000); 

    }); 
}); 
+0

どのようなエラーが表示されますか? –

+0

login1とselectが定義されていません –

+0

私はこの解決策を得ましたが、エラーロケータ要素(by.buttonText( "Login"))が表示されています。見つかりません。 –

答えて

0

更新されたページオブジェクト -

var CustomerLoginPage = function() { 

    this.select=element.all(by.repeater('cust in Customers')); 

    this.login1=element(by.cssContainingText('.btn', 'Login')); 

    this.getCustomer = function() { 
    this.select.getAttribute('value'); 
    } 

    this.showLogin = function() { 
     this.login1.click(); 
    }; 
}; 

module.exports = CustomerLoginPage; 

とspecファイルにはちょうど前のようなもので、それは私の問題を解決しています。

他人に役立つことを願っています。

関連する問題