【发布时间】:2021-02-16 09:06:14
【问题描述】:
我尝试使用 CSV 数据集配置从 CSV 文件创建登录。但不知道为什么它没有选择变量并且在登录页面上输入了带有“用户名”和“密码”的措辞。可以请教吗?
import org.openqa.selenium.*;
import org.openqa.selenium.support.ui.*;
import org.openqa.selenium.support.ui.Select;
WDS.sampleResult.sampleStart();
WDS.browser.get("https://uat-testing.com/" );
sleep(5000);
var Username = WDS.vars.get("username" );
var Password = WDS.vars.get("password" );
WDS.log.info('Username' + Username );
WDS.log.info('Password' + Password );
WDS.browser.findElement(org.openqa.selenium.By.xpath("//input[@type='text']" )).sendKeys("Username" );
WDS.browser.findElement(org.openqa.selenium.By.xpath("//input[@type='password']" )).clear();
WDS.browser.findElement(org.openqa.selenium.By.xpath("//input[@type='password']" )).sendKeys("Password" );
WDS.browser.findElement(org.openqa.selenium.By.xpath("//button/span" )).click();
sleep(10000);
WDS.sampleResult.sampleEnd();
【问题讨论】:
标签: groovy jmeter jmeter-plugins