【发布时间】:2020-10-07 03:01:31
【问题描述】:
我正在使用 JSR223 采样器,我想在 url 加载后开始计算时间,所以我的代码如下:
**
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
System.setProperty("webdriver.gecko.driver","/Users/geckodriver");
FirefoxOptions options = new FirefoxOptions().setAcceptInsecureCerts(true);
options.addArguments("--headless");
WebDriver driver = new FirefoxDriver(options);
def wait = new WebDriverWait(driver, 20);
driver.get('https://google.com/');
WDS.sampleResult.sampleStart();
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(".//input[@name='q']")));
WDS.sampleResult.sampleEnd();
**
【问题讨论】:
-
我基本上需要在 driver.get() 之后开始计算时间。我使用了函数 sampleStart();/sampleEnd();最终出现以下错误:2020-10-07 16:08:11,096 错误 o.a.j.p.j.s.JSR223Sampler:JSR223 脚本 JSR223 采样器中的问题,消息:javax.script.ScriptException:groovy.lang.MissingMethodException:没有方法签名:org.codehaus。 groovy.jsr223.GroovyScriptEngineImpl.sampleStart() 适用于参数类型:() 值:[]
标签: selenium selenium-webdriver jmeter jmeter-plugins jsr233