Reputation: 1
async selectLocalAdmin(){
if(this.localAdmin.visible){
await t.click(this.localAdmin);
}
else{
console.log('not visible');
}
}
I was trying to add some if else statements here and i observe that even when the if statment is true the click function is not happening, any idea on why this is happening?
Upvotes: 0
Views: 326
Reputation: 838
Without a complete sample, I can only say that the selector.visible
property returns a promise (assuming localAdmin
is a Selector
), so you need to add await
:
async selectLocalAdmin() {
if (await this.localAdmin.visible) {
await t.click(this.localAdmin);
}
else{
console.log('not visible');
}
}
If this does not fix the issue, please share the complete test code (include the URL of the tested application, which should be publicly accessible).
Upvotes: 2