Search code examples
javaselenium-webdrivergroovyjmeterjmeter-plugins

Jmeter - Selenium/WebDriver : unable to resolve class org.openqa.selenium.support.ui


os Ubuntu 20.04.6

java --version openjdk 17.0.8.1 2023-08-24

Jmeter v 5.6.2

Selenium/WebDriver Support 4.13.0.0

groovy script

import org.openqa.selenium.support.ui as ui;

WDS.sampleResult.sampleStart()
WDS.browser.get('https://google.com')
WDS.sampleResult.sampleEnd()

LOGS

2023-11-08 19:32:45,303 INFO o.a.j.e.StandardJMeterEngine: Running the test!
2023-11-08 19:32:45,304 INFO o.a.j.s.SampleEvent: List of sample_variables: []
2023-11-08 19:32:45,304 INFO o.a.j.g.u.JMeterMenuBar: setRunning(true, *local*)
2023-11-08 19:32:45,337 INFO o.a.j.e.StandardJMeterEngine: Starting ThreadGroup: 1 : Thread Group
2023-11-08 19:32:45,337 INFO o.a.j.e.StandardJMeterEngine: Starting 1 threads for group Thread Group.
2023-11-08 19:32:45,337 INFO o.a.j.e.StandardJMeterEngine: Thread will continue on error
2023-11-08 19:32:45,337 INFO o.a.j.t.ThreadGroup: Starting thread group... number=1 threads=1 ramp-up=1 delayedStart=false
2023-11-08 19:32:45,338 INFO o.a.j.t.ThreadGroup: Started thread group number 1
2023-11-08 19:32:45,338 INFO o.a.j.e.StandardJMeterEngine: All thread groups have been started
2023-11-08 19:32:45,338 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-1
2023-11-08 19:32:53,300 INFO c.g.j.p.w.c.WebDriverConfig: Created browser object: ChromeDriver: chrome on linux (null)
2023-11-08 19:32:53,326 ERROR c.g.j.p.w.s.WebDriverSampler: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script3.groovy: 14: unable to resolve class org.openqa.selenium.support.ui
 @ line 14, column 1.
   import org.openqa.selenium.support.ui as ui;
   ^

1 error

2023-11-08 19:32:53,326 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-1
2023-11-08 19:32:53,326 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-1
2023-11-08 19:32:53,433 INFO o.a.j.e.StandardJMeterEngine: Notifying test listeners of end of test
2023-11-08 19:32:53,434 INFO o.a.j.g.u.JMeterMenuBar: setRunning(false, *local*)

dir> jmeter/lib

-groovy-3.0.17.jar -selenium-api-4.13.0.jar -selenium-chrome-driver-4.13.0.jar -selenium-chromium-driver-4.13.0.jar -selenium-edge-driver-4.13.0.jar -selenium-firefox-driver-4.13.0.jar -selenium-http-4.13.0.jar -selenium-ie-driver-4.13.0.jar -selenium-json-4.13.0.jar -selenium-os-4.13.0.jar -selenium-remote-driver-4.13.0.jar -selenium-support-4.13.0.jar

i am new to Jmeter. is there anything i missing ? is any path issues ? i want to use WebDriverWait class but i am stuck at unable to resolve class issue any groovy path issue ? i think may be its because of any path mismatch but i dont know about.


Solution

  • Your import statement syntax is incorrect.

    You can either go for star import:

    import org.openqa.selenium.support.ui.*
    

    or static star import:

    import static org.openqa.selenium.support.ui.*
    

    More information: