I have a follow up question on this thread here: What's the correct Protractor's syntax for Page Objects?
This post was useful in understanding page objects especially the answer by : "Xotabu4" but I am running into slightly different problem.
Could someone please help me understand how would one handle a page object that returns an array of elements in a similar model as quoted in the above link by the user. For example, element.all($$) returns an array and I have to compare each element in the array with a certain text. How do I structure that in the model mentioned in the above hyperlink
Assume there is a dropdown list to choose destination implement by <select>
, we need to verify all options with correct text.
<select class="destination">
<option></option>
....
</select>
this.select_destination = element(by.css('select.destination'));
readDestinationOptionsText() {
return this.select_destination.all(by.css('option')).getText();
}
verifyDestinationOptionsText(expectTexts) {
return readDestinationOptionsText().then(function(actualTexts){
return expect(actualTexts.join(',')).toEqual(expectTexts.join(','));
});
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.