I'm trying to get the element with the title class.
The code I use to access the repeater is:
postsList = element.all(by.repeater('post in posts'));
Is there a way to get the element by doing something like the following in jQuery:
var titleText = $("tr:first").find(".title").text();
Is there a way of doing something similar to this with protractor?
回答1:
this should work for your example:
element.all(by.repeater('post in posts')).then(function(posts) { var titleElement = posts[0].element(by.className('title')); expect(titleElement.getText()).toEqual('YourEnteredTitle'); });
回答2:
The answer from nilsK helped me, but didn't work completely. The code below did the trick:
element.all(by.repeater('post in posts')).then(function(posts) { var titleElement = posts[0].element(by.className('title')); expect(titleElement.getText()).toEqual('YourEnteredTitle'); });