Xk6-browser error - getting DevTools URL: context deadline exceeded

Hi,

After installing the xk6-browser as guided in below URL:
Introducing browser automation and end-to-end web testing with k6

Installation went well. But, when I tried to run the example as shown in the above page, I am getting below error,


ERRO[0030] launching browser: getting DevTools URL: context deadline exceeded
running at reflect.methodValueCall (native)
default at file:/xk6-browser-examples/browser-test.js:4:19(5)
at native executor=per-vu-iterations scenario=default source=stacktrace


I am using WSL Ubuntu 20.04.

Kindly request your help to resolve!

Hi,

Thanks for getting in touch. We were able to replicate the issue on a Windows machine using WSL2 running Ubuntu 20.04. We’ve created issue #491 to track this – we’ve made some assumptions on what version of Windows and WSL you were running.

To unblock your progress in working with the xk6-browser, we suggest you work with it outside of WSL using the pre-built binary and also working with our docs (which are still WIP).

Cheers

Thank you Ankur!

For time being, I have switched to Windows. Awaiting for solution soon!!

TA,
Prasanna

@prasannasd We looked into this issue, and found that it happens if you installed the chromium-browser package on Ubuntu, which is a transitional Snap package, and doesn’t work with xk6-browser. Can you confirm if you also have this package installed in your WSL2 Ubuntu installation?

In this case the solution, or workaround rather, is to install Chromium from a native package. Since Ubuntu doesn’t provide one, you’ll have to install it from an external repository. Google has a generic one for Debian and Ubuntu that you can use. See these instructions for details.

You can also manually download and install the package with:

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt -y install ./google-chrome-stable_current_amd64.deb

But I suggest adding the repository instead, as it will allow you to easily upgrade in the future.

Hi @imiric ,

The package “google-chrome-stable/stable,now 104.0.5112.79-1 amd64” is installed and the package “chromium-browser” is not installed on. And it did not work.

I did a workaround. Installed k6 extension on Windows Chrome and used har-to-k6 convertor to get the script.

This is working fine for me for now via regular k6.

@prasannasd It’s great that you have a workaround, but we’d like to better understand this issue so we can fix it.

Can you confirm if you have Ubuntu installed on WSL1 or WSL2? Please post the output of wsl -l -v.