Issue with building xk6-browser as docker image


I was trying to build xk6-browser extension as a docker image by making use of the dockerfile given in github but unfortunately i got an error as:
“Version 106.0.5249.61-1~deb11u1 for chromium was not found”

So modified the version to ‘104.0.5112.79-1~deb11u1’ and created the docker image

While I try to run a sample script of yours where a webpage is loaded and do console.log(page.content()) it gives me empty html with no data as below

So I wonder if the page is actually getting loaded or not?

And if chromium inside docker is working as expected or not?

Can you please help me??


Can you please help me with this quickly… it is blocking my work.

Hi @Akshayini,

Thanks for reporting the issue. We’re working on resolving the chromium issue that you have identified and have an open pull request (PR #631) which will be in the next release (which should be landing early next week).

I have tried to run the fillform.js example and it currently fails unfortunately:

> docker-compose run -T xk6-browser run - <examples/fillform.js                              255 ✘  2m 29s  1.18.2   11:31:42
Creating xk6-browser_xk6-browser_run ... done

          /\      |‾‾| /‾‾/   /‾‾/
     /\  /  \     |  |/  /   /  /
    /  \/    \    |     (   /   ‾‾\
   /          \   |  |\  \ |  (‾)  |
  / __________ \  |__| \__\ \_____/ .io

  execution: local
     script: -
     output: -

  scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
           * default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)

running (00m01.0s), 1/1 VUs, 0 complete and 0 interrupted iterations
default   [   0% ] 1 VUs  00m01.0s/10m0s  0/1 iters, 1 per VU

running (00m02.0s), 1/1 VUs, 0 complete and 0 interrupted iterations
default   [   0% ] 1 VUs  00m02.0s/10m0s  0/1 iters, 1 per VU

running (00m03.0s), 1/1 VUs, 0 complete and 0 interrupted iterations
default   [   0% ] 1 VUs  00m03.0s/10m0s  0/1 iters, 1 per VU

running (00m04.0s), 1/1 VUs, 0 complete and 0 interrupted iterations
default   [   0% ] 1 VUs  00m04.0s/10m0s  0/1 iters, 1 per VU
time="2022-11-04T11:32:17Z" level=error msg="TypeError: Object has no member 'then'\n\tat file:///-:18:70(31)\n\tat native\n" executor=per-vu-iterations scenario=default source=stacktrace

running (00m04.4s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [ 100% ] 1 VUs  00m04.4s/10m0s  1/1 iters, 1 per VU

     browser_dom_content_loaded...: avg=59.12ms min=28µs   med=45µs     max=177.29ms p(90)=141.84ms p(95)=159.57ms
     browser_loaded...............: avg=58.11ms min=139µs  med=183µs    max=174ms    p(90)=139.24ms p(95)=156.62ms
   ✓ checks.......................: 0.00% ✓ 0        ✗ 0
     data_received................: 27 kB 6.1 kB/s
     data_sent....................: 746 B 170 B/s
     http_req_connecting..........: avg=225.5ms min=0s     med=225.5ms  max=451ms    p(90)=405.9ms  p(95)=428.45ms
     http_req_duration............: avg=1.38s   min=96.8ms med=109.18ms max=3.95s    p(90)=3.18s    p(95)=3.57s
     http_req_receiving...........: avg=208ms   min=103ms  med=208ms    max=313ms    p(90)=292ms    p(95)=302.5ms
     http_req_sending.............: avg=0s      min=0s     med=0s       max=0s       p(90)=0s       p(95)=0s
     http_req_tls_handshaking.....: avg=80ms    min=0s     med=80ms     max=160ms    p(90)=144ms    p(95)=152ms
     http_reqs....................: 3     0.684776/s
     iteration_duration...........: avg=4.38s   min=4.38s  med=4.38s    max=4.38s    p(90)=4.38s    p(95)=4.38s
     iterations...................: 1     0.228259/s
     vus..........................: 1     min=1      max=1
     vus_max......................: 1     min=1      max=1

time="2022-11-04T11:32:17Z" level=error msg="communicating with browser: websocket: close 1006 (abnormal closure): unexpected EOF" category=cdp elapsed="0 ms" goroutine=79

Is this the same error you are seeing? If so then the reason for this is that you are trying to run the latest example scripts with an older version of xk6-browser where page.goto is not asynchronous. It’s best to work with the latest version of xk6-browser if you’re trying to run the examples from main. To do this use this Dockerfile:

FROM golang:1.19-bullseye as builder

RUN go install -trimpath

RUN  xk6 build --output "/tmp/k6" --with

FROM debian:bullseye

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

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



Let me know how you get on.


Hi Ankur,

Thank you for the update.

I tried using the above docker file given by you and built the image and ran the same example you have ran (fillform.js) and now the scripts abnormally stops after 30 seconds.

Also tried to change { waitUntil: ‘networkidle’ } to { waitUntil: ‘load’ } in page.goto() but still the same.

Hi @Akshayini,

Thanks for the response with the extras details, but we’ll need some more details from you to help us diagnose the issue.

The fillform.js example test works on my Windows 11 computer using the Dockerfile i sent earlier – admittedly we’ve just merged in several fixes, although I don’t think they should have had any affect on this particular test.

  • What OS version are you running? (WSL/WSL2 or powershell)
  • Can you send us a detail step by step guide as to how you are running the test (which commands).
  • We’re going to assume you’re using the latest version of xk6-browser on main.
  • We’re going to assume you are running an unamended fillform.js test from the examples folder.
  • We’re going to assume you’re are working with the Dockerfile that I sent earlier.


Hi Ankur,

I am running on Windows 10 Enterprise (version 20H2 , OS build 19042.2130)

WSL version:

Here are the steps I followed:
Dockerfile used:

docker build command:

fillform.js file used: (It is unamended)

Command used to run the test:

I am mounting the local volume where fillform.js is there and using the image that I build ‘x-b-4’

Please let me know if anymore details needed.


Could you please respond?

Hi @Akshayini,

Thanks for the detailed reply!

I was able to reproduce the same issue when I tried to run the fillform.js test script from WSL2 using the docker commands that we’ve documented in this thread.

I’ve created an issue which you can follow along here: Exec context changed when running xk6-browser from WSL2 and Docker · Issue #642 · grafana/xk6-browser · GitHub.

In the meantime could you try running this test using docker from outside of WSL2, so in powershell or command prompt? Let me know how you get on with that.