[英]Protractor: TypeError: fn is not a function
運行UI測試時遇到以下錯誤。 我是Java語言的新手,所以我一直都在關注示例代碼,但不確定在哪里出錯。 有人可以解釋為什么我得到這個錯誤,什么是適當的修復?
錯誤:
[13:00:19] E/launcher - fn is not a function
[13:00:19] E/launcher - TypeError: fn is not a function
主頁對象:
Homepage.prototype = Object.create({}, {
checkInBtn: {
get: function () {
return element(by.css('div.checkin.booking-date input'));
}
}, datePickerDay: {
value: function (day) {
return element(by.cssContainingText('.ui-datepicker-calendar a', day));
}
}, selectCheckInDate: {
value: function (day) {
return this.checkInBtn.click().then(this.datePickerDay(day).click());
}
},
});
module.exports = Homepage;
黃瓜量角器步驟文件
this.When(/^I enter the trip information and search$/, function (table) {
var page = new homepage();
var checkOutDay = new Date(data["DepartureDate"]).getDate();
page.selectCheckInDate(checkInDay);
expect(page.checkInBtn.getText()).to.eventually.have.string(checkInDay);
});
問題在於selectedCheckInDate
Homepage.prototype = Object.create({}, {
checkInBtn: {
get: function() {
return element(by.css('div.checkin.booking-date input'));
}
},
datePickerDay: {
value: function(day) {
return element(by.cssContainingText('.ui-datepicker-calendar a', day));
}
},
selectCheckInDate: {
value: function(day) {
var self = this;
this.checkInBtn.click().then(function() {
self.datePickerDay(day).click();
});
}
}
});
module.exports = Homepage;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.