grafana / xk6-browser

k6 extension that adds support for browser automation and end-to-end web testing via the Chrome Devtools Protocol
https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/browser/
GNU Affero General Public License v3.0
325 stars 41 forks source link

"launching browser: browser process ended unexpectedly" #921

Open tmc opened 1 year ago

tmc commented 1 year ago

Brief summary

I get this error with no more detail when running with debug: true and/or --verbose:

ERRO[0000] process with PID 55973 unexpectedly ended: exit status 126  category=browser elapsed="0 ms" goroutine=100
ERRO[0000] Uncaught (in promise) GoError: launching browser: browser process ended unexpectedly
    at github.com/grafana/xk6-browser/browser.mapBrowserType.func2 (native)
    at file:///Users/tmc/xxx/basic-web-interaction.js:10:36(7)  executor=shared-iterations scenario=default

I'd expect more detail here as I don't really know what to do to debug.

xk6-browser version

k6 v0.44.1

OS

macos 13.3.1

Chrome version

114.0.5735.90

Docker version and image (if applicable)

No response

Steps to reproduce the problem

import { chromium } from 'k6/experimental/browser';

export default async function () { const browser = chromium.launch({ headless: false, timeout: '60s', // Or whatever time you want to define }); const page = browser.newPage();

try { await page.goto('https://test.k6.io/'); page.screenshot({ path: 'screenshot.png' }); } finally { page.close(); browser.close(); } }

Expected behaviour

It works.

Actual behaviour

ERRO[0000] process with PID 55973 unexpectedly ended: exit status 126 category=browser elapsed="0 ms" goroutine=100 ERRO[0000] Uncaught (in promise) GoError: launching browser: browser process ended unexpectedly at github.com/grafana/xk6-browser/browser.mapBrowserType.func2 (native) at file:///Users/tmc/xxx/basic-web-interaction.js:10:36(7) executor=shared-iterations scenario=default

barsukov2 commented 1 year ago

Got the same error when I try to launch test in Dockerfile My Dockerfile

FROM golang:1.19-bullseye as builder

RUN go install -trimpath go.k6.io/xk6/cmd/xk6@latest

RUN  xk6 build --output "/tmp/k6" --with github.com/grafana/xk6-browser

FROM debian:bullseye

RUN apt-get update && \
    apt-get install -y chromium

RUN adduser --disabled-password -u 1000 --gecos 1000 k6

COPY --from=builder /tmp/k6 /usr/bin/k6
COPY framework framework
COPY tests tests

ENV K6_BROWSER_HEADLESS=true

USER 1000
ENTRYPOINT ["k6"]
DaniBencz commented 10 months ago

Same here. After following the install steps with HomeBrew. MacOS Ventura 13.4.1, M2 chip

`import { chromium } from 'k6/experimental/browser';

export default async function () { const browser = chromium.launch({ headless: true }); const page = browser.newPage(); page.goto('https://google.com'); }`