Browser redirection failed

Hi Team,

New to xK6 Browser, when I try to enter the username and password and click the login it starts redirecting, and before it loads my account page it gets close. I tried to control it with the following options but it still getting close.

page.waitForLoadState(‘networkidle’);
page.waitForSelector(‘button[id=“account”]’);

ERRO[0006] waitForSelector “button[id="account"]”: execution context with ID 3 not found

But when I applied

sleep(3);
page.waitForSelector(‘button[id=“account”]’);

the waitforselector options work fine and no more errors. How to overcome this issue.

Hi Gerard,

Could you send the full script?

Thanks