Hi
I have a site which need a ssl certificate to install on machine.
i am trying to setup test on linux vm ( GCP ).
I have installed certificate at /usr/local/share/ca-certificates/
dir
verified by running puppeeter test script successfully
const puppeteer = require('puppeteer');
const fs = require('fs');
async function run () {
const browser = await puppeteer.launch({
defaultViewport: {width: 1920, height: 1080},
args: [ '--ignore-certificate-errors' ]
});
const page = await browser.newPage();
await page.goto('siteUrl', {timeout: 60000});
await sleep(15000);
await page.screenshot({path: 'screenshot.png'});
const html = await page.content();
fs.writeFileSync('source.htm', html);
browser.close();
}
run();
function sleep(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}
Now i have tried run k6 script
import { chromium } from 'k6/experimental/browser';
import { check, sleep, expect } from 'k6';
import exec from 'k6/execution';
import { htmlReport } from "./report_bundle.js";
import { textSummary } from "./report_summery_index.js";
import { Trend } from 'k6/metrics';
const users = new Trend('user jurney time', true);
export const options = {
insecureSkipTLSVerify: true,
scenarios: {
browser: {
executor: 'per-vu-iterations',
exec: 'browser',
vus: 1,
iterations: '1'
//duration: '5s',
}
}
};
export async function browser() {
const browser = chromium.launch({
headless: true,
//timeout: '2m',
args: [ '--ignore-certificate-errors' ],
// executablePath: '/snap/bin/chromium',
// userDataDir: "'./chromeProfiles/'"+ exec.vu.idInTest ,
});
const context = browser.newContext(); //one browser instance
//context.setDefaultTimeout(180);
const page = context.newPage(); // one tab
await page.goto('testsite');
console.log('page loaded');
page.screenshot({ path: './actual_page_screenshot333.png'});
page.waitForSelector("div[class$='overlay-box']");
sleep(2);
page.close();
browser.close();
}
Error :
communicating with browser: websocket: close 1006 (abnormal closure): unexpected EOF category=cdp elapsed="0 ms" goroutine=40
ERRO[0030] Uncaught (in promise) GoError: waiting for selector "div[class$='overlay-box']": waiting for selector "div[class$='overlay-box']" did not result in any nodes
browser at github.com/grafana/xk6-browser/browser.mapPage.func11 (native)
i checked screenshot and its very small size blank white page
i checked similar thread and verified steps