Problems and solutions - NextensArelB/SwaggerGenerationTool GitHub Wiki

On this page we list problems and the possible solutions when using Karate at Nextens.

[[TOC]]

Chrome server returned empty list

##Problem When Karate runs Chrome driver in headless mode (in the pipeline) you might see the error:

driver config / start failed: chrome server returned empty list from http://localhost:9222, options: {type=chrome, headless=true, target=null}

##Analyse This might because Chrome has been updated and there was a change that impacted the headless mode.

##Solution In the Karateconfig.js change the way the option to run in headless mode using switch on, here is a example:

karate.configure('driver', { type: 'chrome', executable: 'C://Program Files//Google//Chrome//Application//chrome.exe', addOptions: [runHeadless, '--enable-automation']});

##More information This is caused by a change in Chrome: more information about this issue can be found here

Invalid handshake response getStatus: 403 Forbidden

##Problem When Karate starts Chrome, a window is opened but nothing happens. The log shows the error:

Invalid handshake response getStatus: 403 Forbidden

##Analyse This might because Chrome has been updated and there was a change that impacted test automation capabilities of the browser.

##Solution In the Karateconfig.js add the option to run automation and allow remote origins. For example:

driver_configuration: { headles: headless, executable: chromeExecutable, addOptions: ['--enable-automation', "--remote-allow-origins=*"]}

##More information Open Chrome windows might not close at the end of the test. More investigation is needed to see why this happens.

Getting cookies from login script in karate 1.4

##Problem When running karate 1.4 and you save cookies from the login script, the domain will not be automatically saved

##Solution Set it manually, after saving the cookies :

  * karate.write('{"n_at":"' + accessToken + '", "idsBaseUrl":"' + identityServerUrl + '", "timestamp": ' + timestamp + ', "idsrv":' + idsrv + ', "idsrvSession": ' + idsrvSession + '}', '/testdata/n_at.json')

  # add domain to idsrv cookie, needed for karate 1.4:
  * def authJson = read('file:target/testdata/n_at.json')
  * set authJson.idsrv.domain = identityServerUrl.slice(8)
  * set authJson.idsrvSession.domain = identityServerUrl.slice(8)
  * karate.write(authJson,'testdata/n_at.json')
⚠️ **GitHub.com Fallback** ⚠️