Online Training: Web test automation with CodeceptJS. Sign up now!

grabNumberOfVisibleElements function not returning numeric value

I am using the function I.grabNumberOfVisibleElements to get the element count to check whether the element is present in the page or not. But grabNumberOfVisibleElements function is not returning numeric or integer value instead it is printing Promise { }
Promise { }
Promise { }
Promise { }
In the console. would you please help me to resolve this.

Hello ! example of how you can resolve it and expect/receive a value. You must use async/await

Scenario('xxxxxxxxx ', async (globalMethods) => {
await globalMethods.StartDateDefaultValueValidation();
});

… now inside my page object

async StartDateDefaultValueValidation(){
            ....
	var defaultStartDate = await I.grabAttributeFrom();
	...
}