我有2個獲取文本的變量: locationDisplayed 和 bindisplayed 。我想要第三個變量: expectedDescription 合併前兩個變量的文本。這是代碼:
let locationDisplayed = element(by.css('.badge-primary')).getText().then(function (text) {
}); //location to be compared with Destination field
let bindisplayed = element(by.css('.badge-info')).getText().then(function (text) {
}); //bin to be compared with Destination field
let expectedDescription = locationDisplayed + " "+bindisplayed;
expectedDescription.getText().then(function(text){
console.log(text);
});
但是後來我得到了:ExpectedDescription.getText不是一個函數任何人都知道如何合併2個字符串,並獲得此串聯的字符串?