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
337 stars 42 forks source link

Use /json/version to retrieve ws url #801

Open ankur22 opened 1 year ago

ankur22 commented 1 year ago

Could we use <ip>:<port>/json/version to retrieve the websocket url instead of relying on parsing stdout to retrieve the websocket url? The trouble with using the json endpoint is that we will need to pick and assign the port when launching the browser instance instead of allowing the browser to find an open port, which is an extra moving part in xk6-browser.

tmc commented 1 year ago

This would be nice to support with connect() as well -> allow it to auto-discover.

inancgumus commented 1 year ago

Which IP and port can we connect to without knowing the WebSocket URL firsthand?

I looked into this, and we can use the --remote-debugging-address and --remote-debugging-port flags. However, once we set these to constant values, users won't be able to test with multiple k6 processes, hence the single address and port.