Hi inanc, thanks for replying !
I scraped a part of the code to be more readable, but here’s the full script :
import launcher from 'k6/x/browser';
import { sleep, check } from 'k6';
export let options = {
stages : [{ duration: '10s', target: 1 },
{ duration: '10s', target: 1 },
{ duration: '10s', target: 0 }]
};
export default function(){
var t0, t1;
console.log("Begin");
t0 = Date.now();
const browser = launcher.launch('chromium', { headless: false });
t1 = Date.now();
console.log("Launch done : " + (t1 - t0).toFixed(3));
t0 = Date.now();
const context = browser.newContext({
ignoreHTTPSErrors: false // Ignore HTTPS certificate issues
});
t1 = Date.now();
console.log("Context done : " + (t1 - t0).toFixed(3));
t0 = Date.now();
const page = context.newPage();
t1 = Date.now();
console.log("Page created : " + (t1 - t0).toFixed(3));
t0 = Date.now();
page.goto('https://www.halopedia.org/Through_the_Trees');
t1 = Date.now();
console.log("URL navigated : " + (t1 - t0).toFixed(3));
sleep(7);
// page.mouse.wheel(0, 50);
/*console.log("//////////////////////");
for (var entry in page.mouse){
console.log(entry);
console.log(page.mouse[entry]);
}*/
console.log("//////////////////////");
console.log("Mouse Scrolled !!!")
// sleep(20);
/*page.mouse.move(994, 49);
page.mouse.down();
page.mouse.up();
sleep(1);*/
t0 = Date.now();
page.screenshot({ path: `./H2H.png` });
t1 = Date.now();
console.log("Screenshot taken : " + (t1 - t0).toFixed(3));
browser.close();
console.log("end");
}
I also tried to run the script you shared, but got the following errors :
However, this script ends properly.
As for the google chrome version, I use the V. 96.0.4664.110, on CentOs 7.
NB : Just want to point out that I’m running the script within a VM, within an intranet behind a proxy. But the domain to reach can be pinged
