I am using Jmeter with Selenium Webdriver sampler & JAVA. I have a CSV file with username and password. My test has CSV Data Set Config to read the file and Webdriver sampler. I am writing selenium code in java. I wants to read username and password from CSV file and use it in my selenium script. Here is my code:
import openqa.selenium.OutputType.*;
import org.openqa.selenium.*;
import org.openqa.selenium.support.ui.*;
WDS.sampleResult.sampleStart();
var ctx = org.apache.jmeter.threads.JMeterContextService.getContext();
var vars = ctx.getVariables();
String userName = WDS.args[0]; -- the result of this line is "loginName" instead of actual log in name. same for 2nd line.
//String userName = vars.get('loginName');
The issue i have is its not picking from CSV. The above two lines produce result "loginName" instead of picking actual login name from the file. I have used single quote, double quote etc, but no luck. Using ${loginName} gives error. Any Idea what is wrong and how to fix it?