Appium 求助,升级 java-client6.0.0 和 server1.8.0 后,出现异常.

Then · 2018年06月11日 · 最后由 大熊 回复于 2018年06月13日 · 2146 次阅读

java-client6.0.0BEAT-4 升级为 6.0.0 正式版
server1.7.2 升级为 1.8.0(服务器不升级不会出现以下异常)

升级后直接执行出现:

Exception in thread "Thread-31" java.lang.NoClassDefFoundError: javax/websocket/DeploymentException
at io.appium.java_client.android.ListensToLogcatMessages.(ListensToLogcatMessages.java:34)
at com.appium.Driver.(Driver.java:74)
at com.task.SceneTask.initDriver(SceneTask.java:211)
at com.task.SceneTask.runScene(SceneTask.java:150)
at com.task.SceneTask.runTask(SceneTask.java:129)
at com.task.TaskRunner.runTask(TaskRunner.java:98)
at com.viwer.scenetask.MainTaskUI$StartTaskThread.run(MainTaskUI.java:361)
at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: java.lang.ClassNotFoundException: javax.websocket.DeploymentException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
... 8 more

增加依赖包 websocket-api.jar 后,在执行 driver.getPageSource() 方法时出现

org.openqa.selenium.WebDriverException: java.net.SocketException: Connection reset
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:03.216Z'
System info: host: 'autodeMac-mini.local', ip: '10.1.5.179', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.2', java.version: '10.0.1'
Driver info: driver.version: RemoteWebDriver
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:233)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:46)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.getPageSource(RemoteWebDriver.java:429)
at com.helper.AndroidInfo.getPageSource(AndroidInfo.java:689)
at com.helper.AndroidInfo.waitForNewWindow(AndroidInfo.java:649)
at com.appium.AndroidOp.findElementBy(AndroidOp.java:280)
at com.appium.AndroidOp.HandlePermission(AndroidOp.java:930)
at com.test.android.ver900.General.skipGuide(General.java:65)
at com.test.android.ver900.单项测试.快速检查 (单项测试.java:92)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at com.task.FactoryScene.RunTest(FactoryScene.java:173)
at com.task.SceneTask.runScene(SceneTask.java:158)
at com.task.SceneTask.runTask(SceneTask.java:129)
at com.task.TaskRunner.runTask(TaskRunner.java:98)
at com.viwer.scenetask.MainTaskUI$StartTaskThread.run(MainTaskUI.java:361)
at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: java.net.SocketException: Connection reset
at java.base/java.net.SocketInputStream.read(SocketInputStream.java:210)
at java.base/java.net.SocketInputStream.read(SocketInputStream.java:141)
at okio.Okio$2.read(Okio.java:139)
at okio.AsyncTimeout$2.read(AsyncTimeout.java:237)
at okio.RealBufferedSource.indexOf(RealBufferedSource.java:345)
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:217)
at okhttp3.internal.http1.Http1Codec.readHeaderLine(Http1Codec.java:212)
at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:189)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:88)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
at okhttp3.RealCall.execute(RealCall.java:77)
at org.openqa.selenium.remote.internal.OkHttpClient.execute(OkHttpClient.java:105)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:155)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:218)
... 21 more

求助......

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
共收到 4 条回复 时间 点赞
1楼 已删除
Then #2 · 2018年06月11日 Author

有遇到相同问题的同学欢迎一起探讨

Then #3 · 2018年06月12日 Author

org.openqa.selenium.WebDriverException: java.io.IOException: unexpected end of stream on Connection{0.0.0.0:4723, proxy=DIRECT hostAddress=/0.0.0.0:4723 cipherSuite=none protocol=http/1.1}
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:03.216Z'
System info: host: 'autodeMac-mini.local', ip: '10.1.5.179', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.2', java.version: '10.0.1'
Driver info: driver.version: RemoteWebDriver
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:233) ~[java-client-6.0.0.jar:?]
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543) ~[client-combined-3.12.0.jar:4.4.6]
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:46) ~[java-client-6.0.0.jar:?]
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) ~[java-client-6.0.0.jar:?]
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1) ~[java-client-6.0.0.jar:?]
at org.openqa.selenium.remote.RemoteWebDriver.getPageSource(RemoteWebDriver.java:429) ~[client-combined-3.12.0.jar:4.4.6]
at com.helper.AndroidInfo.getPageSource(AndroidInfo.java:691) [bin/:?]
at com.helper.AndroidInfo.waitForNewWindow(AndroidInfo.java:649) [bin/:?]
at com.appium.AndroidOp.findElementBy(AndroidOp.java:280) [bin/:?]
at com.appium.AndroidOp.HandlePermission(AndroidOp.java:929) [bin/:?]
at com.test.android.ver900.General.skipGuide(General.java:67) [bin/:?]
at com.test.android.ver900.功能遍历.beforeTest(功能遍历.java:37) [bin/:?]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.base/java.lang.reflect.Method.invoke(Method.java:564) ~[?:?]
at com.task.FactoryScene.RunTest(FactoryScene.java:156) [bin/:?]
at com.task.SceneTask.runScene(SceneTask.java:158) [bin/:?]
at com.task.SceneTask.runTask(SceneTask.java:129) [bin/:?]
at com.task.TaskRunner.runTask(TaskRunner.java:98) [bin/:?]
at com.viwer.scenetask.MainTaskUI$StartTaskThread.run(MainTaskUI.java:361) [bin/:?]
at java.base/java.lang.Thread.run(Thread.java:844) [?:?]
Caused by: java.io.IOException: unexpected end of stream on Connection{0.0.0.0:4723, proxy=DIRECT hostAddress=/0.0.0.0:4723 cipherSuite=none protocol=http/1.1}
at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:205) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:88) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.RealCall.execute(RealCall.java:77) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at org.openqa.selenium.remote.internal.OkHttpClient.execute(OkHttpClient.java:105) ~[client-combined-3.12.0.jar:4.4.6]
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:155) ~[client-combined-3.12.0.jar:4.4.6]
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:218) ~[java-client-6.0.0.jar:?]
... 21 more
Caused by: java.io.EOFException: \n not found: limit=0 content=…
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:227) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.http1.Http1Codec.readHeaderLine(Http1Codec.java:212) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:189) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:88) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at okhttp3.RealCall.execute(RealCall.java:77) ~[selenium-server-standalone-3.11.0.jar:9.4.7.v20170914]
at org.openqa.selenium.remote.internal.OkHttpClient.execute(OkHttpClient.java:105) ~[client-combined-3.12.0.jar:4.4.6]
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:155) ~[client-combined-3.12.0.jar:4.4.6]
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:218) ~[java-client-6.0.0.jar:?]
... 21 more

Then #4 · 2018年06月12日 Author

目前发现是在应用启动后立刻执行会大概率出现上述情况,所以启动后等待几秒后再查找来规避...
对于权限有倒计时并且有点慢的手机,就可能出现来不及点权限的情况.

有人解决了吗,我得也是这情况,只要把引用的包换成 java-client6.0.0BEAT-4 就没问题,正式版就会报错,但 appium-desktop 升级了没问题

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册