Home > Mobile >  Jmeter: Class or variable not found: org.openqa.selenium
Jmeter: Class or variable not found: org.openqa.selenium

Time:12-08

Im using Jmeter 5.4.1 and in that I have added a WebDriver Sampler to automate Chrome driver using Java. My test scenario is after navigating to the webpage I want to wait for some 5-8 seconds and then proceed further. For this I am trying to implement Explicit wait in WebDriver Sampler like this:

var pkg = JavaImporter(org.openqa.selenium);
var support_ui = JavaImporter(org.openqa.selenium.support.ui.WebDriverWait);
var ui = JavaImporter(org.openqa.selenium.support.ui);
var wait = new support_ui.WebDriverWait(WDS.browser, 8000);

wait.until(ui.ExpectedConditions.visibilityOfElementLocated(pkg.By.className("closeCookieModal")));

//var cook = WDS.browser.findElement(org.openqa.selenium.By.className("closeCookieModal"));
var cook = WDS.browser.findElement(org.openqa.selenium.By.className("closeCookieModal"));
cook.click();

When executing this code i am getting error with Response code: 500, the error is: Typed variable declaration : Class or variable not found: org.openqa.selenium : at Line: 21

Am i using it correctly for Java?

CodePudding user response:

Your code is in enter image description here

If you're planning to use Java - re-write your code with Java syntax and choose groovy as the language

  • Related