You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 30, 2025. It is now read-only.
Adding page.waitForNavigation(); in place of page.waitForSelector('div.cb-content'); caused a waitForFrameNavigation timed out after 30s.
Script Source
importlauncherfrom'k6/x/browser';import{group,sleep}from'k6';exportdefaultfunction(){constbrowser=launcher.launch('chromium',{headless: false,});constcontext=browser.newContext({});constpage=context.newPage();group("Navigate to Homepage",()=>{page.goto('https://trollflix.com');// without the below waitForSelector, the page.$$ expression returns a length of 0page.waitForSelector('div.cb-content');// required here even if I were to use waitUntil: 'networkidle' above// grab the number of displayed videos (should be 12)constvideoCount=page.$$('div.cb-content').length;console.log(`Found ${videoCount} in page`);});sleep(2);group("Filter by Gaming",()=>{page.hover('#hn-categories');sleep(1);// without the below waitForSelector, the page.$$ expression returns a length of 0 (interestingly, not the previous value - 12 - so the expression was evaluated after the page partially refreshed)page.$('//div[text()="Gaming"]').click();page.waitForSelector('div.cb-content');// waiting for the div here ensures the videoCount updates as expected// grab the number of displayed videos (should be 2)constvideoCount=page.$$('div.cb-content').length;console.log(`Found ${videoCount} in page`);});}