Home > OS >  Jmeter webdriver wait funtion - Can not create new object with constructor org.openqa.selenium.suppo
Jmeter webdriver wait funtion - Can not create new object with constructor org.openqa.selenium.suppo

Time:12-23

I am trying to use the JMeter Selenium Webdriver wait function but getting error output as -

ERROR c.g.j.p.w.s.WebDriverSampler: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: wait for class: Script2

import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriverService;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import static org.openqa.selenium.support.ui.WebDriverWait.*;
import static org.openqa.selenium.support.ui.ExpectedConditions.*
import org.openqa.selenium.support.ui.*;
import openqa.selenium.OutputType.*;  

WDS.sampleResult.sampleStart()


WDS.browser.get(page)
//Thread.sleep(2000);

wait.until(ExpectedConditions.visibilityOfElementLocated(org.openqa.selenium.By.id("email")));

I am using the latest version of Jmeter (5.5) and the latest selenium webdriver support package (4.5.1). This use to work before. Can someone help here please? thanks!!

CodePudding user response:

You forgot to copy and paste one important command - WebDriverWait initialization:

WebDriverWait wait = new WebDriverWait(WDS.browser, java.time.Duration.ofSeconds(5))

More information on Groovy scripting in JMeter: Apache Groovy: What Is Groovy Used For?

  • Related