Please help me to figure out how to get actual values from array instead of these:
[object ReExecutablePromise]
[object ReExecutablePromise]
[object ReExecutablePromise]
[object ReExecutablePromise]
[object ReExecutablePromise]
here is my code example:
test('Reference Type', async t=>{
await loginPage.login(oceanconfig.testUser, oceanconfig.password);
await t.click(HomePage.button);
const rowsNum = await CreateShipmentPage.referenceTypeOption().count;
const arr = [];
for(let i = 1; i< rowsNum-1; i ){
const referenceType = CreateShipmentPage.referenceTypeSelect().innerText;
arr.push(referenceType);
}
const item = await arr.slice(1, 6);
for (let row of item) {
console.log(row);
}
})
CodePudding user response:
It seems that you miss the 'await' operator when getting 'referenceType'. Please try the code below:
test('Reference Type', async t=>{
await loginPage.login(oceanconfig.testUser, oceanconfig.password);
await t.click(HomePage.button);
const rowsNum = await CreateShipmentPage.referenceTypeOption().count;
const arr = [];
for(let i = 1; i< rowsNum-1; i ){
const referenceType = await CreateShipmentPage.referenceTypeSelect().innerText;
arr.push(referenceType);
}
const item = await arr.slice(1, 6);
for (let row of item) {
console.log(row);
}
})