Reputation: 21
I am using JMeter+Groovy and want to wait for the element to display in an UI, but it is failing with this error:
2020-10-06 16:02:03,775 ERROR c.g.j.p.w.s.WebDriverSampler: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: By for class: Script42
My code is:
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait
def wait = new WebDriverWait(WDS.browser,5000);
WDS.sampleResult.sampleStart();
WDS.browser.get('https://google.com/');
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(".//input[@name='q']")));
WDS.sampleResult.sampleEnd()
Upvotes: 0
Views: 981
Reputation: 58862
Add import for missing class(es) at start of the script:
import org.openqa.selenium.By;
Upvotes: 2