Giter Site home page Giter Site logo

wdio-chromedriver-service's People

Contributors

aberonni avatar atti187 avatar christian-bromann avatar codigodiabolico avatar dependabot[bot] avatar erwinheitzman avatar goosewobbler avatar jamesdiacono avatar jamesmortensen avatar m4hdyar avatar olivier-martin-sf avatar praveendvd avatar robd avatar rossvertizan avatar rsheasby avatar shashidharus avatar vjuturu avatar wdio-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wdio-chromedriver-service's Issues

When a wdio-*-service throws a SevereServiceError, chromedriver does not shut down cleanly.

I have observed that when wdio services throw a SevereServiceError, chromedriver hangs and does not shut down.

$ lsof -i :9515
COMMAND    PID USER   FD   TYPE            DEVICE SIZE/OFF NODE NAME
chromedri 8993  jem    6u  IPv4 0x641c20f71e7938b      0t0  TCP localhost:9515 (LISTEN)
chromedri 8993  jem    7u  IPv6 0x641c20f69be5c13      0t0  TCP localhost:9515 (LISTEN)

If the processes are not killed, the next time WebdriverIO is started, it fails since port 9515 is blocked:

Starting ChromeDriver 89.0.4389.23 (61b08ee2c50024bab004e48d2b1b083cdbdac579-refs/branch-heads/4389@{#294}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
[1621021673.016][SEVERE]: bind() failed: Address already in use (48)
IPv4 port not available. Exiting...

It would help if chromedriver shuts down properly when there is a severe error in another service requiring the test runner to stop.

Different port the 9515

The service runs nicely when I use the default port in the config.

As soon as I change the port to any other value the tests fail with:

ERROR: connect ECONNREFUSED 127.0.0.1:10101
chrome

Headless remote debugging

I've tried to set the --remote-debugging-port arg to easily debug headless Chrome, but it looks like tests are not run with that option (without it they run just fine).

Config:

  // ...
  capabilities: [
    {
      browserName: 'chrome',
      maxInstances: 3,
      chromeOptions: {
        args: [
          '--headless',
          '--disable-gpu',
          '--window-size=1280,750',
          '--remote-debugging-port=9222',
        ],
        binary: '/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary',
      },
    },
  ],
  port: '9515',
  path: '/',
  services: ['chromedriver'],
  // ...

I'm using: [email protected], [email protected] and Chrome Canary 61.0.3153.0 (earlier versions have issues on OSX).
Do you know how see/interact with Chrome headless, combining webdriverio browser.debug()?

Chrome console messages visible in output while running the the tests with logLevel set to silent or error

While running tests with WDIO using chromedriver there is Chrome console messages visible in output. There is no way to get rid of them, even by setting webdriver log level to silent.

Starting ChromeDriver 88.0.4324.96 (68dba2d8a0b149a1d3afac56fa74648032bcf46b-refs/branch-heads/4324@{#1784}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
[0-0] RUNNING in chrome - d:\Robocze\bos-frontend-tests\tests\operator\cif\customersCRUDcor.spec.js

DevTools listening on ws://127.0.0.1:53944/devtools/browser/1d076dd7-c8d0-47fc-9c86-6e95d4777b9e

<<<This thing right there>>>
[18196:40464:0202/162948.662:ERROR:device_event_log_impl.cc(211)] [16:29:48.661] USB: usb_service_win.cc:389 Could not read device interface GUIDs: Nie mozna odnalezc okreslonego pliku. (0x2)
[18196:40464:0202/162948.663:ERROR:device_event_log_impl.cc(211)] [16:29:48.662] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: Urzadzenie dolaczone do komputera nie dziala. (0x1F)
[18196:40464:0202/162948.679:ERROR:device_event_log_impl.cc(211)] [16:29:48.678] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: Urzadzenie dolaczone do komputera nie dziala. (0x1F)
[18196:40464:0202/162948.679:ERROR:device_event_log_impl.cc(211)] [16:29:48.679] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: Urzadzenie dolaczone do komputera nie dziala. (0x1F)

Chromedriver error

Getting selenium.common.exceptions.WebDriverException: Message: invalid argument: unrecognized capability: chromeOptions

Getting the above error message while running a project

Handle verbose logging

Is there a way to pass the --verbose flag to ChromeDriver via this service?

In the documentation, we only get this example:

chromedriver.exe --verbose --log-path=chromedriver.log

Is there a way to pass this flag to ChromeDriver via this service?

Thanks!

Update Chromedriver

Hi!

I am having an issue with chromedriver very similar to this one SeleniumHQ/docker-selenium#566 and it seems that should be fixed for newer versions of Chromedriver.

It will be helpful to update the Chromedriver dependency.

See that, trying with yarn upgrade , I am getting this warning:

warning " > [email protected]" has unmet peer dependency "chromedriver@^2.31.0".

Chromdriver args are not working

Hello I am trying to apply different args in the service array but they are not working, I am trying a simple one to maximize the window. Chrome gets launched but is not maximized.

Another argument I want to try --unlimited-storage

Chrome Version: 89.0.4389.90
OS: MacOS 10.14.6
Node: v12.20.0
NPM: 6.14.8

"devDependencies": {
"@wdio/cli": "^7.2.3",
"@wdio/firefox-profile-service": "^7.2.1",
"@wdio/local-runner": "^7.2.3",
"@wdio/mocha-framework": "^7.2.1",
"@wdio/spec-reporter": "^7.2.1",
"@wdio/sync": "^7.2.3",
"chromedriver": "^89.0.0",
"wdio-chromedriver-service": "^7.0.0"
}

services: [
        ['chromedriver', {
            logFileName: 'wdio-chromedriver.log', // default
            outputDir: 'driver-logs', // overwrites the config.outputDir
            args: ['--start-maximized']
        }]
      ],

No longer works with chrome 85?

I'd been using this package to run WDIO with chrome v83 previously, but now that chrome 85 is out and installed on machine it no longer works.

It tells me to update chromedriver to v85.

Config is read too early

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}`)

ERROR: connect ECONNREFUSED 127.0.0.1:9515

Often, just right starting the tests, I get this error:

ERROR: connect ECONNREFUSED 127.0.0.1:9515
chrome
    at new RuntimeError (.../node_modules/webdriverio/build/lib/utils/ErrorHandler.js:144:12)
    at Request._callback (.../node_modules/webdriverio/build/lib/utils/RequestHandler.js:327:43)
    at self.callback (.../node_modules/webdriverio/node_modules/request/request.js:186:22)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at Request.onRequestError (.../node_modules/webdriverio/node_modules/request/request.js:878:8)
    at emitOne (events.js:121:20)
    at ClientRequest.emit (events.js:211:7)
    at Socket.socketErrorListener (_http_client.js:387:9)
    at emitOne (events.js:116:13)

I'm running my tests with wdio with these settings:

capabilities: [
    {
      browserName: 'chrome',
      maxInstances: 4,
      chromeOptions: {
        args: [
              '--headless',
              // fix headless chrome gpu bug
              '--disable-gpu',
              // force win size as wdio call might not work
              '--window-size=1280,750',
            ],
      },
    },
  ],
  sync: true,
  logLevel: 'silent',
  coloredLogs: true,
  connectionRetryCount: 3,
  services: ['chromedriver', 'visual-regression'],
  path: '/',
  port: '9515',

I've also tried adding --ignore-certificate-errors flag, but it didn't help. Running the command again may succeed, but sometime I have to re-run it 3-4 times before success.
On top of that, headless chrome instances are not closed when that error happens. The first time I noticed it, I had hundreds running...

Unhandled Request Error

webdriverio will not connect to chrome driver unless spawn is changed to exec in chromedriver library here.

Node: v10.15.3
chromedriver: 74.0.3729.6
chrome: 74.0.3729.108
macOS: 10.14.4

new version

Can you release a new version with the support for chromedriver arguments?

Thanks

Cannot set hostname, port via webdriverio config file

Hello!

I discovered that the latest version of wdio-chromedriver-service (6.0.3) does not correctly handle hostname and port parameters that are defined via wdio configuration file. Instead of using the specified hostname and port, session is started on local chromedriver. Moreover, from the version 6.0.0 default port is seems to be changed from 4444 to 9515. The aforementioned issues make it impossible to run test suites on the own remote selenium instance. I have created a small PoC project for this issue. There are
two branches:

  • issue/hostname branch contains latest version of wdio-chromedriver-service. If you install modules and run tests using node_modules/.bin/wdio wdio.conf.js, tests will run on local instance of the chromedriver and ignore specified hostname and port in the wdio.conf.js
[0-0] 2020-08-12T09:46:43.405Z DEBUG @wdio/local-runner:utils: init remote session
[0-0] 2020-08-12T09:46:43.406Z INFO webdriverio: Initiate new session using the webdriver protocol
[0-0] 2020-08-12T09:46:43.409Z INFO webdriver: [POST] http://localhost:9515/session
[0-0] 2020-08-12T09:46:43.414Z INFO webdriver: DATA { capabilities:
   { alwaysMatch: { browserName: 'chrome' }, firstMatch: [ {} ] },
  desiredCapabilities: { browserName: 'chrome' } }
[0-0] (node:9550) ExperimentalWarning: Readable[Symbol.asyncIterator] is an experimental feature. This feature could change at any time
[0-0] { browserName: 'chrome',
  protocol: 'http',
  hostname: 'localhost',
  port: 9515,
  path: '/' }
  • issue/chromedriver branch uses version 6.0.0 of the wdio-chromedriver-service. As a result, if you run tests using node_modules/.bin/wdio wdio.conf.js command, tests will use the specified dummy hostname and port and will fail as expected.
    PoC:
[0-0] 2020-08-12T09:43:17.896Z DEBUG @wdio/local-runner:utils: init remote session
[0-0] 2020-08-12T09:43:17.897Z INFO webdriverio: Initiate new session using the webdriver protocol
[0-0] 2020-08-12T09:43:17.899Z INFO webdriver: [POST] http://test.com:1678/session
[0-0] 2020-08-12T09:43:17.899Z INFO webdriver: DATA { capabilities:
   { alwaysMatch: { browserName: 'chrome' }, firstMatch: [ {} ] },
  desiredCapabilities: { browserName: 'chrome' } }

OS details:

  • Ubuntu 19.10
  • node version 10.15.2
  • npm version 6.14.7

RFE: Ability to filter ChromeDriver output

ChromeDriver produces too much stdio output in some common circumstances. See the following for context:

It would be nice to be able to ignore these messages because nothing is broken per se (most reports I have read state that apps continue to work despite the dire warnings).

At least it would be nice to be able to ignore these messages if nothing can be done about it in any case. It’s not feasible for me to fix the underlying ChromeDriver issue, for example. And I already tried:

    chromeDriverArgs: ['--silent']

wdio-chromedriver-service could implement something since it has access to the ChromeDriver process here:

    this.process = await ChromeDriver.start(this.chromeDriverArgs, true)

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

For example, I can silence the output altogether like this:

    this.process = await ChromeDriver.start(this.chromeDriverArgs, true)

    this.process.stderr.on('data', () => {})
    this.process.stdout.on('data', () => {})

I believe filtering ChromeDriver messages could be generally useful, which is why I propose adding a formal mechanism to the service.

If you disagree, I’d appreciate (and I’m sure others would as well) if you could vote up, or add your observations to, https://bugs.chromium.org/p/chromedriver/issues/detail?id=2909.

Thanks

chromeOptions unrecognized

Hi, the chromedriver works correctly, but only without chromeOptions. I'm using the same structure like here (without --remote-debugging-port, binary and port: '9515').
Chrome version 75.0.3770.142. Following error pops up:

Starting ChromeDriver 75.0.3770.90 (a6dcaf7e3ec6f70a194cc25e8149475c6590e025-refs/branch-heads/3770@{#1003}) on port 4444
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[0-0] RUNNING in chrome - C:\Users\something\e2e\features\2-Employees\1-SmokeTest.feature
[0-0] 2019-07-29T13:43:11.982Z ERROR webdriver: Request failed due to invalid argument: invalid argument: unrecognized capability: chromeOptions
    at getErrorFromResponseBody (C:\Users\something\e2e\node_modules\webdriver\build\utils.js:371:10)
    at Request._callback (C:\Users\something\e2e\node_modules\webdriver\build\request.js:120:64)
    at Request.self.callback (C:\Users\something\e2e\node_modules\request\request.js:185:22)
    at Request.emit (events.js:189:13)
    at Request.EventEmitter.emit (domain.js:441:20)
    at Request.<anonymous> (C:\Users\something\e2e\node_modules\request\request.js:1161:10)
    at Request.emit (events.js:189:13)
    at Request.EventEmitter.emit (domain.js:441:20)
    at IncomingMessage.<anonymous> (C:\Users\something\e2e\node_modules\request\request.js:1083:12)
    at Object.onceWrapper (events.js:277:13)
0-0 worker error { name: 'invalid argument',
  message: 'invalid argument: unrecognized capability: chromeOptions',
  stack:
   'invalid argument: invalid argument: unrecognized capability: chromeOptions\n    at getErrorFromResponseBody (C:\\Users\\senovsky\\gitlab\\hakkastack\\e2e\\node_modules\\webdriver\\build\\utils.js:371:10)\n    at Request._callback (C:\\Users\\senovsky\\gitlab\\hakkastack\\e2e\\node_modules\\webdriver\\build\\request.js:120:64)\n    at Request.self.callback (C:\\Users\\senovsky\\gitlab\\hakkastack\\e2e\\node_modules\\request\\request.js:185:22)\n    at Request.emit (events.js:189:13)\n    at Request.EventEmitter.emit (domain.js:441:20)\n    at Request.<anonymous> (C:\\Users\\senovsky\\gitlab\\hakkastack\\e2e\\node_modules\\request\\request.js:1161:10)\n   
 at Request.emit (events.js:189:13)\n    at Request.EventEmitter.emit (domain.js:441:20)\n    at IncomingMessage.<anonymous> (C:\\Users\\senovsky\\gitlab\\hakkastack\\e2e\\node_modules\\request\\request.js:1083:12)\n    at Object.onceWrapper (events.js:277:13)' }
[0-0] 2019-07-29T13:43:11.985Z ERROR @wdio/runner: invalid argument: invalid argument: unrecognized capability: chromeOptions
    at getErrorFromResponseBody (C:\Users\something\e2e\node_modules\webdriver\build\utils.js:371:10)
    at Request._callback (C:\Users\something\e2e\node_modules\webdriver\build\request.js:120:64)
    at Request.self.callback (C:\Users\something\e2e\node_modules\request\request.js:185:22)
    at Request.emit (events.js:189:13)
    at Request.EventEmitter.emit (domain.js:441:20)
    at Request.<anonymous> (C:\Users\something\e2e\node_modules\request\request.js:1161:10)
    at Request.emit (events.js:189:13)
    at Request.EventEmitter.emit (domain.js:441:20)
    at IncomingMessage.<anonymous> (C:\Users\something\e2e\node_modules\request\request.js:1083:12)
    at Object.onceWrapper (events.js:277:13)
2019-07-29T13:43:11.986Z ERROR @wdio/local-runner: Failed launching test session: TypeError: Cannot read property 'capabilities' of null
    at Runner.run (C:\Users\something\e2e\node_modules\@wdio\runner\build\index.js:91:74)
    at process._tickCallback (internal/process/next_tick.js:68:7)
[0-0] FAILED in chrome - C:\Users\something\e2e\features\2-Employees\1-SmokeTest.feature

Oudated DevDependency "chromedriver": "^2.45.0"

"chromedriver": "*" is correctly listed in peerDependencies, however "chromedriver": "^2.45.0" is also listed in devDependencies causing an error that "Chrome version must be between 71 and 75" even though in the most recent chromedriver the most recent version of Chrome is accepted.

Error: Invalid or unsupported WebDriver capabilities found ("pollTimeout")

I tried to upgrade from 8.0.1 to 8.1.0 today but after the upgrade my tests fail with the message:

[0-3] 2023-02-13T19:19:54.819Z ERROR @wdio/runner: Error: Invalid or unsupported WebDriver capabilities found ("pollTimeout"). Ensure to only use valid W3C WebDriver capabilities (see https://w3c.github.io/webdriver/#capabilities).If you run your tests on a remote vendor, like Sauce Labs or BrowserStack, make sure that you put them into vendor specific capabilities, e.g. "sauce:options" or "bstack:options". Please reach out to to your vendor support team if you have further questions.

Is this a regression from 2c738d3 ?

Instructions fail to work

Tried configuring this for a while, without success. I have installed all the npm packages, both locally and globally (just to see if it made a difference), set the port to 9515 and set services to `['chromedriver'], but nothing ever happens:

$(npm bin)/wdio --logLevel verbose

[18:21:02]  COMMAND	POST 	 "/wd/hub/session"
[18:21:02]  DATA		{"desiredCapabilities":{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"maxInstances":5,"browserName":"chrome","chromeOptions":{"args":["//headless","disable-gpu"],"prefs":{"credentials_enable_service":false}},"loggingPrefs":{"browser":"ALL","driver":"ALL"},"requestOrigins":{"url":"http://webdriver.io","version":"4.6.2","name":"webdriverio"}}}
ERROR: unknown command: wd/hub/session
chrome
Error
Full config
exports.config = {
    
    specs: [
        'tests/acceptance/**/*-test.js'
    ],
    exclude: [
    ],
    maxInstances: 10,
    capabilities: [{
        maxInstances: 5,
        browserName: 'chrome',
        'chromeOptions': {
            'args': [
                'disable-gpu'
            ],
            prefs: {'credentials_enable_service': false }
        }
    }],
    port: '9515',
    sync: true,
    logLevel: 'silent',
    coloredLogs: true,
    bail: 0,
    screenshotPath: './errorShots/',
    waitforTimeout: 30000,
    connectionRetryTimeout: 90000,
    connectionRetryCount: 3,
     services: ['chromedriver'],
    
    framework: 'mocha',
    mochaOpts: {
        timeout: 30000
    },
    mochaOpts: {
        ui: 'bdd'
    },
}

Feature - Luncher Timeout from options

Hi,

Now there is a POLL_TIMEOUT in luncher.js. The timeout amount is hardcoded to 10 Seconds. But when you use something like
Electron Service and Electron it can be possible that it takes more than 10 seconds. Specially when you run everything in debugging mode.
So I suggest adding timeout to options.

If you think it makes sense I can create a pull request for it.

Thanks.

"Cannot read property 'toLowerCase'" error when using multi remote `capabilities` configuration

I was using Wdio 5.x and upgraded to 6.1 (the wdio-chromedriver-service is at version 6.0.3) which caused my tests to no longer run

I have multi remote configured according to these instructions https://webdriver.io/docs/multiremote.html#using-wdio-testrunner:

export.config = {
       // snip
        capabilities:  {
            browser1: { capabilities: { browserName: 'chrome'} },
            browser2: { capabilities: { browserName: 'chrome'} }
        },
       // snip
        services: [
            ['chromedriver', {
                args: ['--silent'] //
            } ]
        ],
       // snip
  }

but when I run wdio I get the following in my console:

[0-0] RUNNING in MultiRemote - /test/specs/end_to_end_call.js
[0-0]  Error:  Failed to create session.
Unable to connect to "http://127.0.0.1:9222/", make sure browser driver is running on that address.
If you use services like chromedriver see initialiseServices logs above or in wdio.log file as the service might had problems to start the driver.

and the log file is as follows:

2020-05-28T23:49:10.964Z INFO @wdio/cli:launcher: Run onPrepare hook
2020-05-28T23:49:10.966Z ERROR @wdio/cli:utils: A service failed in the 'onPrepare' hook
TypeError: Cannot read property 'toLowerCase' of undefined
    at isChrome (/home/marc/Projects/braidio/src/kandy_rtc_tester/node_modules/wdio-chromedriver-service/build/launcher.js:26:41)
    at ChromeDriverLauncher._mapCapabilities (/home/marc/Projects/braidio/src/kandy_rtc_tester/node_modules/wdio-chromedriver-service/build/launcher.js:87:13)
    at ChromeDriverLauncher.onPrepare (/home/marc/Projects/braidio/src/kandy_rtc_tester/node_modules/wdio-chromedriver-service/build/launcher.js:58:10)
    at /home/marc/Projects/braidio/src/kandy_rtc_tester/node_modules/@wdio/cli/build/utils.js:51:33
    at Array.map (<anonymous>)
    at runServiceHook (/home/marc/Projects/braidio/src/kandy_rtc_tester/node_modules/@wdio/cli/build/utils.js:49:39)
    at Launcher.run (/home/marc/Projects/braidio/src/kandy_rtc_tester/node_modules/@wdio/cli/build/launcher.js:79:40)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Is there something I am missing here?

7.3.0 Spawns Chromedriver process and then times out waiting for port to free up.

Didn't see an issue template here, but when working with our testing partner. The upgrade to 7.3.0 started making all of our tests fail with the newly introduced error.

#73

Was the 'waitUntilFree' supposed to be executed prior to the launch of the child process? Perhaps even wrapping it? Instead it appears to run directly after chromedriver is launched and times out reporting that the port is in use. This occurred in an environment that runs many agents.

Move project to WebdriverIO Community Org

Hey @atti187,

first off, thank you for creating this plugin and extending the WebdriverIO ecosystem!

I was wondering if you would be interested moving this repository into the WebdriverIO Community organisation. It would allow us to help maintain this package, automate a few things like releases and allow others to contribute to it and make the package even better. You would of course continue to have full access to it.

What do you think? Please let me know if you have any questions.

Chrome doesn't seem to be starting on Travis-CI

Just forking this on github and enabling Travis-CI errors out with:

ERROR: unknown error: Chrome failed to start: crashed

I have a small project that uses wdio-chromedriver-service, and travis tests stopped working a few weeks ago.

Release process

Hi!

You have released v6 but it's having some issues.
The way Babel is setup in this project requires source-map-support to be a dependency
It seems that NPM releases are being made manually
So without NODE_ENV set in the environment
Therefor the sourcemap is not stripped out the compiled code
Because of this the WebdriverIO team uses https://www.npmjs.com/package/np for releasing packages to release
I would advice to do the same so that the releases cannot go wrong.

Could you please re-release v6 with the NODE_ENV set because currently we get:

Error: Couldn't initialise "wdio-chromedriver-service".
Error: Cannot find module 'source-map-support/register'

RequestError: connect ECONNREFUSED (Only one usage of each socket address is normally permitted)

Issue: On running two specs simultaneously in different terminals, facing RequestError: connect ECONNREFUSED

here's the wdio.conf.js file used,

exports.config = {
    specs: [
        './test/specs/test_one.js',
        './test/specs/test_two.js',
    ],
    maxInstances: 10,
    capabilities: [{
        maxInstances: 5,
        browserName: 'chrome',
        acceptInsecureCerts: true
    }],
    logLevel: 'debug',
    baseUrl: 'http://localhost',
    waitforTimeout: 10000,
    waitforInterval: 500,
    connectionRetryTimeout: 120000,
    connectionRetryCount: 3,
    services: [
        ['chromedriver', {
            port: 7676
        }],
    ],
    framework: 'mocha',
    reporters: ['spec'],
    mochaOpts: {
        ui: 'bdd',
        bail: 1,
        timeout: 600000
    },
    // onPrepare: function (config, capabilities) {
    // },
    // onWorkerStart: function (cid, caps, specs, args, execArgv) {
    // },
    // onComplete: function(exitCode, config, capabilities, results) {
    // },
    // onReload: function(oldSessionId, newSessionId) {
    // }
}

here, I am running two specs wdio wdio.conf.js --spec test_one.js in terminal one and wdio wdio.conf.js --spec test_two.js in terminal two simultaneously

On debugging I found that port 7676 is not available for terminal two because of the error Only one usage of each socket address (protocol/network address/port) is normally permitted.

logs

2021-12-24T09:58:32.943Z WARN chromedriver: [1640339912.943][SEVERE]: bind() returned an error: Only one usage of each socket address (protocol/network address/port) is normally permitted. (0x2740)
2021-12-24T09:58:32.944Z INFO chromedriver: IPv6 port not available. Exiting...



[0-0] 2021-12-24T09:58:35.926Z ERROR webdriver: RequestError: connect ECONNREFUSED 127.0.0.1:7676
[0-0]     at ClientRequest.<anonymous> (C:\Hiver\Workspace\qa-wdio\node_modules\got\dist\source\core\index.js:956:111)
[0-0]     at Object.onceWrapper (events.js:422:26)
[0-0]     at ClientRequest.emit (events.js:327:22)
[0-0]     at ClientRequest.EventEmitter.emit (domain.js:467:12)
[0-0]     at ClientRequest.origin.emit (C:\Hiver\Workspace\qa-wdio\node_modules\@szmarczak\http-timer\dist\source\index.js:43:20)
[0-0]     at Socket.socketErrorListener (_http_client.js:469:9)
[0-0]     at Socket.emit (events.js:315:20)
[0-0]     at Socket.EventEmitter.emit (domain.js:467:12)
[0-0]     at emitErrorNT (internal/streams/destroy.js:106:8)
[0-0]     at emitErrorCloseNT (internal/streams/destroy.js:74:3)
[0-0]     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
[0-0] FAILED in chrome - C:\Hiver\Workspace\qa-wdio\test\specs\hiver.tags.js

Is there any way to handle this?

Expected Solution :
It would be better if ports are allocated dynamically if the specified port 7676 or default 9515 is already being used.
for example, in launcher.js onPrepare() I tried checking the port availability and assigning port dynamically as below which worked fine and the error was cleared.

        if (await tcpPortUsed.check(this.options.port, this.options.hostname)) {
            const server = net.createServer()
            const { port } = server.unref().listen().address()
            server.close()
            this.options.port = port;
        }

Enhancement: Add property chromeDriverBinary to enable specification in wdio.conf.js

Hello

I am not sure how to use a self-prescribed chromedriver binary which may be required by a software development kit.

I don't know how to specify a chromedriver binary of your choice in the local file system.

Even if I were attempting to use the chromedriver in wdio-chromedriver-service that is supposed to work "out of the box", I am not sure I know how to make that work that either. I followed the instructions but unable to avoid: Error: Couldn't initialise "wdio-chromedriver-service".

With the same wdioconf.js file (as the one that produces the output below) I can comment out one line:
services: ['chromedriver']
then manually start the SDK-provided chromedriver, from another shell: ./bin/chromedriver --port=9515, then run wdio. That works as expected.

I would like to know how to do two things:

  • Specify the path to a special chromedriver binary that exists in my file system
  • Get the wdio-chromedriver-service to use the chromedriver included as a peer dependency

I read the other issues to try to find the answer. Particularly notable is #11. It was a surprise to hear @christian-bromann not imagine a reason to use a specific older version of software as opposed to the latest and current version. Maybe he is only thinking about things in the realm of being "out in front" of the latest browser changes and not the creation of test cases for legacy code.

Thank you for writing this service. It is just the right functionality to encapsulate! I appreciate your foresight.

If any resulting code or documentation changes result from my question, then I will watch closely with intent of helping to support this package.

And please let me know if the log is insufficient and does not give you everything you may need to help me.

$ DEBUG=true ./node_modules/.bin/wdio wdio.conf.js
2019-05-19T22:53:05.132Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "chromedriver"
2019-05-19T22:53:05.145Z ERROR @wdio/utils:initialiseServices: Error: Couldn't initialise "wdio-chromedriver-service".
Error: Cannot find module 'chromedriver'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
    at Function.Module._load (internal/modules/cjs/loader.js:506:25)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/Users/tester/go/src/github.com/acme/webapps/app1/integration/webdriverio/node_modules/wdio-chromedriver-service/build/launcher.js:10:44)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at safeRequire (/Users/tester/go/src/github.com/acme/webapps/app1/integration/webdriverio/node_modules/@wdio/utils/build/initialisePlugin.js:19:13)
    at initialisePlugin (/Users/tester/go/src/github.com/acme/webapps/app1/integration/webdriverio/node_modules/@wdio/utils/build/initialisePlugin.js:56:18)
    at initialiseServices (/Users/tester/go/src/github.com/acme/webapps/app1/integration/webdriverio/node_modules/@wdio/utils/build/initialiseServices.js:64:53)
    at Launcher.run (/Users/tester/go/src/github.com/acme/webapps/app1/integration/webdriverio/node_modules/@wdio/cli/build/launcher.js:70:52)
    at launch (/Users/tester/go/src/github.com/acme/webapps/app1/integration/webdriverio/node_modules/@wdio/cli/build/run.js:88:12)
    at run (/Users/tester/go/src/github.com/acme/webapps/app1/integration/webdriverio/node_modules/@wdio/cli/build/run.js:64:12)
    at Object.run (/Users/tester/go/src/github.com/acme/webapps/app1/integration/webdriverio/node_modules/@wdio/cli/build/index.js:45:20)
    at Object.<anonymous> (/Users/tester/go/src/github.com/acme/webapps/app1/integration/webdriverio/node_modules/@wdio/cli/bin/wdio.js:11:21)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
2019-05-19T22:53:05.146Z INFO @wdio/cli:Launcher: Run onPrepare hook
2019-05-19T22:53:05.148Z INFO @wdio/local-runner: Start worker 0-0 with arg: wdio.conf.js

RUNNING  0-0 in chrome - /test/specs/basic.js

Stdout:
[0-0] 2019-05-19T22:53:05.339Z INFO @wdio/local-runner: Run worker command: run
[0-0] 2019-05-19T22:53:05.343Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "chromedriver"
[0-0] 2019-05-19T22:53:05.360Z DEBUG @wdio/local-runner:utils: init remote session
[0-0] 2019-05-19T22:53:05.382Z INFO webdriver: [POST] http://127.0.0.1:9515/session
[0-0] 2019-05-19T22:53:05.382Z INFO webdriver: DATA { capabilities:
    { alwaysMatch: { browserName: 'chrome', chromeOptions: [Object] },
      firstMatch: [ {} ] },
   desiredCapabilities:
    { browserName: 'chrome',
      chromeOptions:
       { binary:
          '../../desktop/sdk/osx32/chromium.app/Contents/MacOS/chromebrowser' } } }
[0-0] 2019-05-19T22:53:05.392Z INFO webdriver: Retrying 1/3
[0-0] 2019-05-19T22:53:05.392Z INFO webdriver: [POST] http://127.0.0.1:9515/session
[0-0] 2019-05-19T22:53:05.392Z INFO webdriver: DATA { capabilities:
    { alwaysMatch: { browserName: 'chrome', chromeOptions: [Object] },
      firstMatch: [ {} ] },
   desiredCapabilities:
    { browserName: 'chrome',
      chromeOptions:
       { binary:
          '../../desktop/sdk/osx32/chromium.app/Contents/MacOS/chromebrowser' } } }
[0-0] 2019-05-19T22:53:05.393Z INFO webdriver: Retrying 2/3
[0-0] 2019-05-19T22:53:05.394Z INFO webdriver: [POST] http://127.0.0.1:9515/session
[0-0] 2019-05-19T22:53:05.394Z INFO webdriver: DATA { capabilities:
    { alwaysMatch: { browserName: 'chrome', chromeOptions: [Object] },
      firstMatch: [ {} ] },
   desiredCapabilities:
    { browserName: 'chrome',
Stdout:
[0-0] 2019-05-19T22:53:05.339Z INFO @wdio/local-runner: Run worker command: run
[0-0] 2019-05-19T22:53:05.343Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "chromedriver"
[0-0] 2019-05-19T22:53:05.360Z DEBUG @wdio/local-runner:utils: init remote session
[0-0] 2019-05-19T22:53:05.382Z INFO webdriver: [POST] http://127.0.0.1:9515/session
[0-0] 2019-05-19T22:53:05.382Z INFO webdriver: DATA { capabilities:
    { alwaysMatch: { browserName: 'chrome', chromeOptions: [Object] },
      firstMatch: [ {} ] },
   desiredCapabilities:
    { browserName: 'chrome',
      chromeOptions:
       { binary:
          '../../desktop/sdk/osx32/chromium.app/Contents/MacOS/chromebrowser' } } }
[0-0] 2019-05-19T22:53:05.392Z INFO webdriver: Retrying 1/3
[0-0] 2019-05-19T22:53:05.392Z INFO webdriver: [POST] http://127.0.0.1:9515/session
[0-0] 2019-05-19T22:53:05.392Z INFO webdriver: DATA { capabilities:
    { alwaysMatch: { browserName: 'chrome', chromeOptions: [Object] },
      firstMatch: [ {} ] },
   desiredCapabilities:
    { browserName: 'chrome',
      chromeOptions:
       { binary:
          '../../desktop/sdk/osx32/chromium.app/Contents/MacOS/chromebrowser' } } }
[0-0] 2019-05-19T22:53:05.393Z INFO webdriver: Retrying 2/3
[0-0] 2019-05-19T22:53:05.394Z INFO webdriver: [POST] http://127.0.0.1:9515/session
[0-0] 2019-05-19T22:53:05.394Z INFO webdriver: DATA { capabilities:
    { alwaysMatch: { browserName: 'chrome', chromeOptions: [Object] },
      firstMatch: [ {} ] },
   desiredCapabilities:
    { browserName: 'chrome',
      chromeOptions:
       { binary:
          '../../desktop/sdk/osx32/chromium.app/Contents/MacOS/chromebrowser' } } }
[0-0] 2019-05-19T22:53:05.394Z INFO webdriver: Retrying 3/3
[0-0] 2019-05-19T22:53:05.394Z INFO webdriver: [POST] http://127.0.0.1:9515/session
[0-0] 2019-05-19T22:53:05.395Z INFO webdriver: DATA { capabilities:
    { alwaysMatch: { browserName: 'chrome', chromeOptions: [Object] },
      firstMatch: [ {} ] },
   desiredCapabilities:
    { browserName: 'chrome',
      chromeOptions:
       { binary:
          '../../desktop/sdk/osx32/chromium.app/Contents/MacOS/chromebrowser' } } }

Stderr:
[0-0] 2019-05-19T22:53:05.358Z ERROR @wdio/utils:initialiseServices: Error: Couldn't initialise "wdio-chromedriver-service".
Error: Cannot find module 'chromedriver'
     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
     at Function.Module._load (internal/modules/cjs/loader.js:506:25)
     at Module.require (internal/modules/cjs/loader.js:636:17)
     at require (internal/modules/cjs/helpers.js:20:18)
     at Object.<anonymous> (/Users/tester/go/src/github.com/acme/webapps/app1/integration/webdriverio/node_modules/wdio-chromedriver-service/build/launcher.js:10:44)
     at Module._compile (internal/modules/cjs/loader.js:688:30)
     at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
     at Module.load (internal/modules/cjs/loader.js:598:32)
     at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
     at Function.Module._load (internal/modules/cjs/loader.js:529:3)
     at safeRequire (/Users/tester/go/src/github.com/acme/webapps/app1/integration/webdriverio/node_modules/@wdio/utils/build/initialisePlugin.js:19:13)
     at initialisePlugin (/Users/tester/go/src/github.com/acme/webapps/app1/integration/webdriverio/node_modules/@wdio/utils/build/initialisePlugin.js:56:18)
     at initialiseServices (/Users/tester/go/src/github.com/acme/webapps/app1/integration/webdriverio/node_modules/@wdio/utils/build/initialiseServices.js:64:53)
     at Runner.run (/Users/tester/go/src/github.com/acme/webapps/app1/integration/webdriverio/node_modules/@wdio/runner/build/index.js:88:35)
     at process.on.m (/Users/tester/go/src/github.com/acme/webapps/app1/integration/webdriverio/node_modules/@wdio/local-runner/build/run.js:37:20)
     at process.emit (events.js:187:15)
     at emit (internal/child_process.js:812:12)
     at process._tickCallback (internal/process/next_tick.js:63:19)
[0-0] 2019-05-19T22:53:05.392Z WARN webdriver: Request failed due to connect ECONNREFUSED 127.0.0.1:9515
[0-0] 2019-05-19T22:53:05.393Z WARN webdriver: Request failed due to connect ECONNREFUSED 127.0.0.1:9515
[0-0] 2019-05-19T22:53:05.394Z WARN webdriver: Request failed due to connect ECONNREFUSED 127.0.0.1:9515
[0-0] 2019-05-19T22:53:05.395Z ERROR webdriver: Request failed due to Error: connect ECONNREFUSED 127.0.0.1:9515
     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1113:14)
[0-0] 2019-05-19T22:53:05.395Z ERROR @wdio/runner: Error: connect ECONNREFUSED 127.0.0.1:9515
     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1113:14)
[0-0] 2019-05-19T22:53:05.396Z ERROR @wdio/local-runner: Failed launching test session: TypeError: Cannot read property 'capabilities' of null
     at Runner.run (/Users/tester/go/src/github.com/acme/webapps/app1/integration/webdriverio/node_modules/@wdio/runner/build/index.js:91:74)
     at process._tickCallback (internal/process/next_tick.js:68:7)

Worker Error:
Error: connect ECONNREFUSED 127.0.0.1:9515
     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1113:14)

Test Suites:	 0 passed, 1 failed, 1 total (100% completed)
Time:		 🕔  0.28s

error Command failed with exit code 1.

Thank you very much!

Unable to start wdio runner

I am not sure where to report this issue - in wdio's runner or here. Please let me know if this is an issue with webdriverio and not this service.

With version 5 of webdriver io, I used the CLI and installed chromedriver service. I then started the runner but then ran into an error:

ERROR wdio-local-runner:utils: TypeError: Service is not a constructor

After debugging, I found out that runner is expecting a service to be exported by this module, as can be seen in this statement. But this module does not export anything.

Is it possible to have a single instance?

I'm noticing this spawns a new Chrome window for each spec. Is it possible to configure the number of processes used for a test. In particular, is it possible to have a single instance and run each test serially?

chromedriver package needs to be dependency of this project

Hey,

thanks for making this service for WebdriverIO. I was just recently using it and was confused why I had to extra install the Chromedriver NPM package. How about we make this as a dependency to this project so everyone who is downloading the service is good to go.

Cheers
Christian

Chromedriver should be a peerDependency

Right now the Chromedriver seems bound to this package. I think it would be more appropriate to let people decide which version they would like to have installed, and rather set limits on the semantic versioning in peerDependencies: { 'chromedriver': '2.x' } }.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.