Search code examples
javascriptselenium-webdriverautomationportnightwatch.js

Error connecting to localhost on port 4445. with Nightwatch and Selenium


I'm trying to run my script using Nightwatch(Javascript), but I'm getting this error :

      \ Connecting to localhost on port 4445...

     ‼ Error connecting to localhost on port 4445.
      × failed
        Error: An error occurred while retrieving a new session: "session not created: This 
        version 
       of ChromeDriver only supports Chrome version 90"   

      × failed
      Error: Nightwatch client is not ready.
                Looks like function "createSession" did not succeed or was not called yet.
      at Object.globals [as get] (C:\automation-Nightwatcg-12-27\QA Automation 
     \node_modules\nightwatch-api\lib\proxy.js:21:17)
      at World.<anonymous> (C:\automation-Nightwatcg-12-27\QA 
      Automation\/cucumber.conf.js:72:17) 

From nightwatch.js.conf

    webdriver: {
    start_process: !Boolean(process.env.NIGHTWATCH_SELENIUM_GRID),
    port: process.env.NIGHTWATCH_SELENIUM_PORT || 4445,
   
    }, 

I tried to run ChromeDriver

  Starting ChromeDriver 96.0.4664.45 (76e4c1bb2ab4671b8beba3444e61c0f17584b2fc-refs/branch- 
  heads/4664@{#947}) 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.

So when running ChromeDriver, I can see it is running on port 9515 . I tried to edit the file nightwatch.js.conf with the port 9515 , but it didn't work.

I also did those steps, but they didn't help Delete your package-lock.json file and node_modules folder. Then do npm cache clean 1-npm cache clean --force 2-npm install

It seems I have a port conflict Does anyone has an idea to to proceed with this issue ? thank you in advance


Solution

  • This version of ChromeDriver only supports Chrome version 90

    This straight away looks to me like a compatibility issue between the chrome version you have on your machine and the chrome driver version you are using. maybe you need to update both of them to be compatible.