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?
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:
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 go.k6.io/xk6/cmd/xk6@latest
RUN xk6 build --output "/tmp/k6" --with github.com/grafana/xk6-browser@main
FROM debian:bullseye
RUN apt-get update && \
apt-get install -y chromium
COPY --from=builder /tmp/k6 /usr/bin/k6
ENV XK6_HEADLESS=true
ENTRYPOINT ["k6"]
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.
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.
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.
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.
I tried to execute in linux virtual machine I got the error below.
docker-compose run -T xk6-browser run fillform.js
Creating xk6-browser_xk6-browser_run ... done
/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io
time="2023-07-21T02:26:50Z" level=warning msg="The moduleSpecifier \"fillform.js\" has no scheme but we will try to resolve it as remote module. This will be deprecated in the future and all remote modules will need to explicitly use \"https\" as scheme."
time="2023-07-21T02:26:58Z" level=error msg="The moduleSpecifier \"fillform.js\" couldn't be found on local disk. Make sure that you've specified the right path to the file. If you're running k6 using the Docker image make sure you have mounted the local directory (-v /local/path/:/inside/docker/path) containing your script and modules so that they're accessible by k6 from inside of the container, see https://k6.io/docs/using-k6/modules#using-local-modules-with-docker. Additionally it was tried to be loaded as remote module by prepending \"https://\" to it, which also didn't work. Remote resolution error: \"Get \"https://fillform.js\": dial tcp: lookup fillform.js on 127.0.0.11:53: no such host\""
ERROR: 255