groovy Jmeter - Selenium/WebDriver:无法解析org.openqa.selenium.support.ui类

w6lpcovy  于 2023-11-16  发布在  其他
关注(0)|答案(1)|浏览(122)

操作系统Ubuntu 20.04.6
Java --版本OpenJDK 17.0.8.1 2023-08-24
Jmeter v5.6.2
Selenium/WebDriver支持4.13.0.0
groovy脚本

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

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

字符串
日志

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 -驱动程序-4.13.0.jar- selenium - chrome -驱动程序-4.13.0.jar- selenium -边缘-驱动程序-4.13.0.jar- selenium -火狐-驱动程序-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
    我是新来的Jmeter.有什么我错过了吗?是任何路径问题?我想使用WebDriverWait类,但我卡在无法解决类问题任何groovy路径问题?我想可能是因为任何路径不匹配,但我不知道.
fwzugrvs

fwzugrvs1#

您的import语句语法不正确。
你可以选择星星导入:

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

字符串
或静态星星导入:

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


更多信息:

相关问题