Hi Team,
Came across a problem where none of the wait is working-
sleep(30)
waitForLoadState(‘domcontentloaded’)
waitForTimeout(10000);
waitForNavigation({ waitUntil: ‘networkidle’ })
I have written a script where after clicking a link it opens other page which take some time to load…but after clicking on like, after loading some content of page, browser abnormal close with below error -
communicating with browser: websocket: close 1006 (abnormal closure): unexpected EOF category=cdp elapsed="4899 ms" goroutine=184 iteration_id=ceea2a010e6aaa67
the last command shown in logs before it crash -
fid:1D04C5F52146B3CA7D4DDA0EFEC25BCA furl:"pageurl" rid:31124.325 category="Frame:deleteRequest" elapsed="0 ms" goroutine=577 iteration_id=ceea2a010e6aaa67
in order to manage that first I used all types of wait but nothing work, so finally I used sleep() and it worked-
page.waitForSelector(xpath),
page.hover(xpath)
page.waitForNavigation(),
page.$(xpath).click(),
sleep(30)
page.waitForSelector(xpath)
Now I have build k6 using main branch as -
xk6 build --output xk6-browser --with github.com/grafana/xk6-browser@main
and now converted script as -
await page.hover(xpath)
await page.locator(xpath).click()
//sleep(30)
//await page.waitForLoadState('domcontentloaded')
//await page.waitForTimeout(10000);
//await page.waitForNavigation({ waitUntil: 'networkidle' })
await page.waitForSelector(xpath)
await page.locator(xpath).click(),
here I tried all the waits but nothing is working and browser is crashing with same error -
communicating with browser: websocket: close 1006 (abnormal closure): unexpected EOF category=cdp elapsed="4899 ms" goroutine=184 iteration_id=ceea2a010e6aaa67
and the last command shown in logs before it crash -
fid:1D04C5F52146B3CA7D4DDA0EFEC25BCA furl:"pageurl" rid:31124.325 category="Frame:deleteRequest" elapsed="0 ms" goroutine=577 iteration_id=ceea2a010e6aaa67