Skip to content

Check if port is already in use #553

@christian-bromann

Description

@christian-bromann

Expected Behavior

If I start selenium standalone on a port that is already in use I should get a proper error message telling me this problem.

Current Behavior

If the running server response with a 404 the package tries to connect couple of times and eventually fails with no proper error message.

Steps to Reproduce

Provide an unambiguous set of steps to reproduce this bug. Include commands that you used
in the shell, or snippets of how you are using the JavaScript API.

  1. Run Chromedriver in one terminal chromedriver --port=4444 --url-base=/ --verbose
  2. Setup WebdriverIO: npm i @wdio/cli & npx wdio config
  3. Pick @wdio/selenium-standalone-service
  4. run tests via npx wdio

Logs

npx wdio 

Execution of 1 workers started at 2021-06-17T10:02:26.059Z 
2021-06-17T10:02:26.115Z INFO @wdio/cli:launcher: Run onPrepare hook 

Failed to connect to selenium. Attempts left: 6 
 Response code 404 (Not Found)
Failed to connect to selenium. Attempts left: 5 
 Response code 404 (Not Found)
Failed to connect to selenium. Attempts left: 4 
 Response code 404 (Not Found)
Failed to connect to selenium. Attempts left: 3 
 Response code 404 (Not Found)
Failed to connect to selenium. Attempts left: 2 
 Response code 404 (Not Found)
Failed to connect to selenium. Attempts left: 1 
 Response code 404 (Not Found)
Failed to connect to selenium. Attempts left: 0 
 Response code 404 (Not Found)

2021-06-17T10:02:41.632Z ERROR @wdio/cli:utils: A service failed in the 'onPrepare' hook 
Error: Unable to connect to selenium 
    at checkStarted (/Users/christianbromann/Sites/WebdriverIO/issues/sel4/node_modules/selenium-standalone/lib/check-started.js:33:10)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

Continue...

Your Environment

  • Version of selenium-standalone that you are using:
  • Is there another tool calling selenium-standalone on your behalf:
  • System/platform:
  • Other details that might be important:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions