David Essien
David Essien

Reputation: 1625

webdriverio: SevereServiceError: Couldn't start Chromedriver: timeout Please check if port 9515 is in use

I am learning how to use webdriver io, I have installed the necessary packages, but when I run the command to test, I get the error that the port may already be in use.

Full logs

npm run wdio

> [email protected] wdio
> wdio run wdio.conf.js


Execution of 1 workers started at 2022-03-14T18:56:58.789Z

2022-03-14T18:56:58.810Z INFO @wdio/cli:launcher: Run onPrepare hook
2022-03-14T18:56:58.811Z INFO chromedriver: Start Chromedriver (/home/davidshare/Documents/davidshare/QA/webdriverio-test/node_modules/chromedriver/lib/chromedriver/chromedriver) with args --port=9515 --url-base=/
2022-03-14T18:56:58.820Z INFO chromedriver: Starting ChromeDriver 99.0.4844.51 (d537ec02474b5afe23684e7963d538896c63ac77-refs/branch-heads/4844@{#875}) on port 9515
2022-03-14T18:56:58.821Z INFO chromedriver: Only local connections are allowed.
2022-03-14T18:56:58.821Z INFO chromedriver: Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
2022-03-14T18:56:58.821Z INFO chromedriver: ChromeDriver was started successfully.
2022-03-14T18:57:08.818Z INFO @wdio/local-runner: Shutting down spawned worker
2022-03-14T18:57:09.070Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2022-03-14T18:57:09.071Z INFO @wdio/local-runner: shutting down
Error: 
A service failed in the 'onPrepare' hook
SevereServiceError: Couldn't start Chromedriver: timeout
Please check if port 9515 is in use!
    at ChromeDriverLauncher.onPrepare (/home/davidshare/Documents/davidshare/QA/webdriverio-test/node_modules/wdio-chromedriver-service/build/launcher.js:96:13)
    at async /home/davidshare/Documents/davidshare/QA/webdriverio-test/node_modules/@wdio/cli/build/utils.js:28:17
    at async Promise.all (index 0)
    at async Launcher.run (/home/davidshare/Documents/davidshare/QA/webdriverio-test/node_modules/@wdio/cli/build/launcher.js:86:13)



Stopping runner...
    at /home/davidshare/Documents/davidshare/QA/webdriverio-test/node_modules/@wdio/cli/build/utils.js:44:35
    at async Launcher.run (/home/davidshare/Documents/davidshare/QA/webdriverio-test/node_modules/@wdio/cli/build/launcher.js:86:13)

When I run the netstat -tulpn command, I see that chrome driver is the one using the port. But even when I kill the process using the pid and then run the command again, I still get the same error.

Please I need help with this.

node --version
v16.13.0
Google Chrome 99.0.4844.51

Upvotes: 2

Views: 7397

Answers (4)

Vignesh V
Vignesh V

Reputation: 31

Kill the processes that are running in that port and then try to execute (solution for linux machine).

lsof -i:9515 - Will list all active process(s) listening to 9515 port.

kill $(lsof -t -i:9515) - This will kill all the process(s).

This worked for me. - Thanks!

Upvotes: 3

Emebet
Emebet

Reputation: 1

Update with the previous version of chrome then run npm install fix the problem. "chromedriver": "^98.0.0",

Upvotes: 0

Akhil
Akhil

Reputation: 29

This is bug with "wdio-chromedriver-service": "7.3.0". It was released a day ago. Try using previous version "7.2.8" in package.json.

Upvotes: 2

Prem Sudheer
Prem Sudheer

Reputation: 81

Tried with version "wdio-chromedriver-service": "7.2.8" in package.json, Working fine

Upvotes: 1

Related Questions