Reputation: 845
I got a Testscript with more than 8 Webdriver-Sampler and a variable, which change in some of the Webdriver-Sampler.
For Example:
First Sampler: status = "login successful"
Second Sampler: status = "login successful, search for something failed"
Third Sampler: status = "login successful, search for something failed, logout successful"
So I have to pass the variable everytime and then edit this variable. I know it is possible to pass a varibale about the Parameter-field. But how can I edit a user define variable in script?
Upvotes: 1
Views: 5542
Reputation: 168072
You can access JMeterVariables class instance via JMeterContext.getVariables() method like:
var vars = org.apache.jmeter.threads.JMeterContextService.getContext().getVariables()
vars.put('foo','bar')
var foo = vars.get('foo')
//etc
See The WebDriver Sampler: Your Top 10 Questions Answered guide for more WebDriver Sampler tips and tricks
Upvotes: 8