xk6-browser icon indicating copy to clipboard operation
xk6-browser copied to clipboard

Browser cannot find the executable path if the executablePath option is null

Open GavinB-hpe opened this issue 2 years ago • 4 comments

If the executablePath is set to null, then chromium will not be found. My expectation would be that null should imply default behavior.

export default function() {
    const browser = launcher.launch('chromium', {
        executablePath: null,       // Override search for browser executable in favor of specified absolute path
    });

GavinB-hpe avatar Jun 21 '22 08:06 GavinB-hpe

Hi @GavinB-hpe,

If you want xk6-browser to find the executable path, you should not include executablePath option. Then again, I agree with you that, providing a null value should imply the default behavior, or better yet, raise a better error.

Is there a reason for providing a null value for the option instead of omitting it?

Thanks.

inancgumus avatar Jun 21 '22 09:06 inancgumus

I just did a copy-paste of all the options from the documentation, and was going to experiment with a few of them. I suspect a number of k6 beginner folks may get caught out by this.

GavinB-hpe avatar Jun 21 '22 09:06 GavinB-hpe

Especially as the error message is wrong - it says browser executable not in $PATH or something similar. And of course it is!

GavinB-hpe avatar Jun 21 '22 09:06 GavinB-hpe

Thanks for raising this @GavinB-hpe. I think we're going to go down the route of making the error message clearer (as well as the documentation) to ensure that the null for executablePath is a bad input value.

ankur22 avatar Jun 21 '22 11:06 ankur22