Skip to content
This repository was archived by the owner on Aug 3, 2023. It is now read-only.

Config is read too early #37

@RafalSkorka

Description

@RafalSkorka

Hi, could you read the settings in the onPrepare hook and not in the constructor of ChromeDriverLauncher?
The reason is I want to set a randomly chosen port, but since getting such port is an async function I can do it only in wdio config onPrepare hook.
Such setting is ignored by chromerdriver service because it reads the config already in the constructor.
You get the config in the onPrepare hook so something like this snippet below would fix my problem: :)

in https://github.com/atti187/wdio-chromedriver-service/blob/master/src/launcher.js

    async onPrepare(config) {
        this.args.forEach(argument => {
            if (argument.includes('--port')) {
                throw new Error('Argument "--port" already exists')
            }
            if (argument.includes('--url-base')) {
                throw new Error('Argument "--url-base" already exists')
            }
        })

        this.options.port = config.port || this.options.port;
        this.args.push(`--port=${this.options.port}`)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions