'Getting error as "karate.org.apache.http.conn.HttpHostConnectException" while running test cases on Karate

First Case: On Local Eclipse

Issue: While running test cases on Karate, I am getting below error where

Feature file as below:

      Background: 
        
        * configure driver = { type: 'chrome', start: false, showDriverLog: true }
    
      Scenario: Verify
        Given driver 'https://www.google.com/'
        And input('input[name=q]', 'karate-dsl')

Console error as below:

  15:14:30.630 [main] ERROR com.intuit.karate - karate.org.apache.http.conn.HttpHostConnectException: Connect to localhost:9222 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused (Connection refused), http call failed after 4 milliseconds for url: http://localhost:9222/json
15:14:32.636 [main] DEBUG com.intuit.karate - request:
1 > GET http://localhost:9222/json
1 > Host: localhost:9222
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_321)
1 > Accept-Encoding: gzip,deflate


15:14:32.638 [main] ERROR com.intuit.karate - karate.org.apache.http.conn.HttpHostConnectException: Connect to localhost:9222 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused (Connection refused), http call failed after 3 milliseconds for url: http://localhost:9222/json
15:14:32.640 [main] ERROR com.intuit.karate - driver config / start failed: http call failed after 3 milliseconds for url: http://localhost:9222/json, options: {type=chrome, start=false, showDriverLog=true, target=null}
com.intuit.karate.KarateException: http call failed after 3 milliseconds for url: http://localhost:9222/json

If we make a change in driver config as below as it is hitting the native chrome. It starts to work fine,

  • configure driver = { type: 'chrome', start: true, showDriverLog: true }

Second Case: On Docker Image, "https://hub.docker.com/r/ptrthomas/karate-chrome", if driver config change as below:

  • configure driver = { type: 'chrome', start: true, showDriverLog: true } Getting the same above error on docker image.

Is it supposed to config differently for local and docker image or I am missing something. Can some one please help ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source