I want to scroll by pixels in karate framework.
I have tried this:
* def scrollDown =
"""
function () {
var results = window.scrollTo(0,500);
return results;
}
"""
* call scrollDown
And I got this error:
org.graalvm.polyglot.PloyglotException: ReferenceError: "window" is not defined
CodePudding user response:
You can use script function to execute any JavaScript snippet.
function () {
var results = script('window.scrollTo(0,500)');
return results;
}
More information can be found at https://github.com/karatelabs/karate/tree/master/karate-core#script