java 测试selenium脚本报ClassnotFound:org.openqa.selenium.remote.ProtocolHandshake

weixin_40226368 2018-12-14 03:08:28

在测试selenium的脚本时,eclipse中总是报这个错误,一天了,在网上查的也没有原因.
...全文
1582 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
知识的行走者 2021-02-22
  • 打赏
  • 举报
回复
我也出现了同样的问题 java.lang.NoClassDefFoundError: org/openqa/selenium/remote/ProtocolHandshake at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:98) at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:96) at com.testing.appui.AppiumDemo.test(AppiumDemo.java:39) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124) at org.testng.internal.Invoker.invokeMethod(Invoker.java:583) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109) at org.testng.TestRunner.privateRun(TestRunner.java:648) at org.testng.TestRunner.run(TestRunner.java:505) at org.testng.SuiteRunner.runTest(SuiteRunner.java:455) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415) at org.testng.SuiteRunner.run(SuiteRunner.java:364) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208) at org.testng.TestNG.runSuitesLocally(TestNG.java:1137) at org.testng.TestNG.runSuites(TestNG.java:1049) at org.testng.TestNG.run(TestNG.java:1017) at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:73) at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123) Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.ProtocolHandshake at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 27 more <dependency> <groupId>io.appium</groupId> <artifactId>java-client</artifactId> <version>6.0.0-BETA3</version> <scope>test</scope> </dependency> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>3.3.1</version> </dependency>
¥ⁿ 2020-03-17
  • 打赏
  • 举报
回复
Starting ChromeDriver 79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch-heads/3945@{#614}) on port 4558 Only local connections are allowed. Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code. [1584413617.489][WARNING]: Timed out connecting to Chrome, retrying... 三月 17, 2020 10:53:38 上午 org.openqa.selenium.remote.ProtocolHandshake createSession 信息: Detected dialect: W3C 跑selenium 这报错是什么意思
¥ⁿ 2020-03-17
  • 打赏
  • 举报
回复
Starting ChromeDriver 79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch-heads/3945@{#614}) on port 4558 Only local connections are allowed. Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code. [1584413617.489][WARNING]: Timed out connecting to Chrome, retrying... 三月 17, 2020 10:53:38 上午 org.openqa.selenium.remote.ProtocolHandshake createSession 信息: Detected dialect: W3C
weixin_40226368 2018-12-24
  • 打赏
  • 举报
回复
原因是,当时创建的maven 项目,但是是添加下载下来的jar包,文件,而不是直接放在pom.xml文件中的,所以导致一直找不到这个依赖中的ProtocolHandshake.
现在这个问题已解决,另外就是NoSuchElement,可能是因为在测试前端页面的时候,默认的入口不是首页,而是从其他页面跳转过去的,就会导致这样的问题.
还有can not create a new session ,需要添加 appWaitActivity,但是添加之后又报版本的问题,这个时候看了下pom文件中java-client是5.4的版本,所以将版本改为最新的6.1.
总之这个弄得好坎坷,而最坎坷的不是代码,而是因为环境没弄好,懊悔,下次把问题想的简单点,把细节做的仔细点,
Estrally 2021-11-19
  • 举报
回复
@weixin_40226368 能讲讲怎么解决的吗

5,177

社区成员

发帖
与我相关
我的任务
社区描述
软件工程/管理 质量管理/软件测试
功能测试压力测试安全性测试 个人社区 湖南省·长沙市
社区管理员
  • 软件测试
  • 虫无涯
  • 小博测试成长之路
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

欢迎大家加入到软件测试的社区,在这里,希望大家勇于发表自己的看法,欢迎大家分享自己在软件测试工作过程中遇到的问题以及工作经验分享。

1.想转行的小伙伴,遇到问题没有及时回复的,可以私聊小博进行反馈

2.大家对社区有好的建议,都可以在社区发帖进行反馈

推荐大家学习的软件测试入门笔记:软件测试入门学习笔记

试试用AI创作助手写篇文章吧