Get frequent chrome driver error: driver config / start failed: chrome server returned empty list from http://localhost:(port) in karate standalone

I used to get frequent chrome driver error in karate UI tests. I have been using karate tests in VS code for the past 5 months. Now, I used to get driver config / start failed: chrome server returned empty list from http://localhost:[port] frequently. Sometimes, I need to run 20 times to run the same test to succeed. All other runs throws either "driver config / start failed: chrome server returned empty list" / "ERROR com.intuit.karate - evaluation of 'karate-config.js' failed: javascript function call failed"

I have installed chrome multiple times but I get the same error. Also I have re-imaged my laptop due this issue and through something went wrong. Even now I used to get the above errors often.

I have installed Chrome 64 bit in windows laptop, it get installed in "C:\Program Files\Google\Chrome\Application\chrome.exe" but karate standalone will always check the Chrome path "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" in runtime which doesn't exists.

Note: I have set the chrome.exe installed path in my system environment PATH but karate not considering the path variable. Please advise me on this.

So I have modified the driver config as given below:-

* configure driver = { type: 'chrome', headless: true  } 

[To]

* configure driver = { type: 'chrome', executable: 'C:/Program Files/Google/Chrome/Application/chrome.exe', headless: true  } 

Karate version: 0.9.6.RC3 OS : Windows 10 Home

JDK Version

openjdk version "11" 2018-09-25 OpenJDK Runtime Environment 18.9 (build 11+28) OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)

Chrome Driver config

Chrome Driver Errors

testui.feature:8 - driver config / start failed: chrome server returned empty list from http://localhost:54311, options: {type=chrome, executable=C:/Program Files/Google/Chrome/Application/chrome.exe, headless=true, target=null}

ERROR com.intuit.karate - evaluation of 'karate-config.js' failed: javascript function call failed: [1.1:33] test_page.feature:9 - driver config / start failed: chrome server returned empty list from http://localhost:55676, options: {type=chrome, executable=C:/Program Files/Google/Chrome/Application/chrome.exe, headless=true, target=null}

ERROR com.intuit.karate - evaluation of 'karate-config.js' failed: javascript function call failed: [1.1:33] test_page.feature:11 - evaluation (js) failed: input('#username', 'admin'), failed to get reply for: [id: 23, method: Input.dispatchKeyEvent, params: {modifier=0, type=keyDown, text=k}]

Please guide me how to resolve this issue.

Thanks, Chandra

Upvotes: 3

Views: 5098

Answers (5)

uwevil
uwevil

Reputation: 666

Just for anyone who has same case as me. Some of chrome process did not close correctly so I need to close all chrome instances. And it works.

Upvotes: 0

AndrewJC
AndrewJC

Reputation: 1478

This was the top hit for a recent search I had for this symptom. In my case it turned out the be realted to the new Chorme headless mode. Adding my fix here in case it can be helpful to others:

In my case, explicitly using addOptions to specify headless new fixed this symptom for me:

* configure driver = { type: 'chrome', headless: true, addOptions: [ '--headless=new' ] }

More context:

Upvotes: 1

mguzelel
mguzelel

Reputation: 11

I have solved my problem by defining in the config file as; "karate.configure('driver', { type: 'chrome', port: 9222, executable: 'C://Program Files//Google//Chrome//Application//chrome.exe' });"

maybe assigning a port help me to solve the issue but one thing to consider here is that u need to use forward slashes in the executable command.

Upvotes: 1

Majedur
Majedur

Reputation: 3242

I was same error. Actually its finding chrome.exe in different location where actually its not located.

In default it's looking at "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"

but actual path was 'C:/Users/ues/AppData/Local/Google/Chrome/Application/chrome.exe'

So check your chrome.exe path.

Hope it's helpful.

Upvotes: 1

Peter Thomas
Peter Thomas

Reputation: 58128

No one else has reported this, so you'll need to figure this out maybe with the help of someone who can troubleshoot your machine. Maybe there are some permission restrictions. Maybe your old processes are still running, so make sure you go to your task manager and kill them etc, this is quite common on Windows.

And please upgrade to 1.0 before trying anything else, because that may help: https://github.com/intuit/karate/wiki/1.0-upgrade-guide

Otherwise we will need your help to maybe debug and suggest changes to the framework. Ideally you should contribute code to Karate, and remember - it is an open source project. If you are able to replicate your problems, follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue - but I'm not sure that is possible with the kinds of issues you are describing.

If none of the above options work, you may need to consider switching to some other framework.

EDIT: most teams run on CI + Docker which is much more stable: https://stackoverflow.com/a/62325328/143475

Upvotes: 0

Related Questions