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

How to make use of seeElement function?

I am new to codecept and i know that seeElement is used to identify whether the element is visible or not. My ask is how to use the return value of seeElement to proceed with my coding. I just want to write if else based on whether the element is visible or not. Can someone please help me on this ?

There is no return value in seeElement method. You just put the element as a parameter then it will pass if element is visible and will be failed if element not visible. No need to use if else statement. such as

I.seeElement(’.k-list-container’);

Hi Rashed, Thanks for you reply but still my code flow has to be different based on element visibility.

Then use grabNumberOfVisibleElements, grabTextFrom etc methods within an async function according to your purpose. Such as

const userInfo= await I.grabNumberOfVisibleElements(.user-info);

if(userInfo){
//your code
}