abdul khan
abdul khan

Reputation: 183

Unable to execute karate script() method

I am trying to migrate one of selenium test to karate, while doing this I am using script() method defined in documentation which is used in karate for evaluating the given string as JavaScript within the browser but I am getting this

enter image description here

driver.executeScript("sauce:job-result=passed");

Also Sharing my feature file which getting failed:

enter image description here

Also Even I tried calling below statement in my script but still getting the same error

* script("console.log('hello world')")

I am using testImplementation("com.intuit.karate:karate-core:1.2.0.RC1") version with gatling

Upvotes: 1

Views: 231

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58058

First - try version 1.2.0.RC6 that has some fixes for the console.log() issue.

I also must say that sauce:job-result=passed does not look like valid JavaScript to me. Please take some time to read the docs: https://github.com/karatelabs/karate/tree/master/karate-core#karate-vs-the-browser

If still stuck, follow this process. That is the only way to replicate and for us to determine what fixes we need to make (if any): https://github.com/karatelabs/karate/wiki/How-to-Submit-an-Issue

See this answer for ideas on how to troubleshoot things at your end: https://stackoverflow.com/a/71952132/143475

Upvotes: 1

Related Questions