I have an encrypt.js script that is used to encrypt and decrypt the password entered by user. It is embedded in the application webpage.
I try to load the same script in jmeter using this code
load ('/apache-jmeter-5.6.3/scripts/encrypt.js');
upon running it, I got this error.
2024-02-27 09:55:47,729 ERROR o.a.j.p.j.s.JSR223Sampler: Problem in JSR223 script JSR223 Sampler, message: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.load() is applicable for argument types: (String) values: [/apache-jmeter-5.6.3/scripts/encrypt.js]
In the language, I used groovy since there is no javascript in the dropdown list. How can I successfully import the javascript in jmeter?
Trying to load and encryption js provided by the dev to successfully login into the application
If you're trying to use Global.load() function from Mozilla Rhino to load an external JavaScript file - you won't be able to do this using Groovy language. You will need to switch to javascript
For example if your "encrypt.js" file has the following function:
function myFunction(name) {
return 'Hello, ' + name + '!'
}
you can load it and call it in JMeter as follows:
However be aware that using JavaScript is: