原始错误:io.appium.uiautomator2.common.exceptions.UiAutomator2Exception

时间:2019-01-24 06:06:16

标签: java selenium automation appium

  • 运行脚本时遇到未知的服务器端错误。
  • 脚本将在滚动时终止,否则它将正常工作。

记录错误:

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: io.appium.uiautomator2.common.exceptions.UiAutomator2Exception: java.lang.IllegalStateException: UiAutomation not connected!
    at io.appium.uiautomator2.utils.UiExpressionParser.invokeMethod(UiExpressionParser.java:251)
    at io.appium.uiautomator2.utils.UiScrollableParser.consumeMethodCall(UiScrollableParser.java:124)
    at io.appium.uiautomator2.utils.UiScrollableParser.parse(UiScrollableParser.java:60)
    at io.appium.uiautomator2.utils.UiAutomatorParser.consumeStatement(UiAutomatorParser.java:93)
    at io.appium.uiautomator2.utils.UiAutomatorParser.parse(UiAutomatorParser.java:49)
    at io.appium.uiautomator2.utils.LocationHelpers.toSelectors(LocationHelpers.java:95)
    at io.appium.uiautomator2.utils.LocationHelpers.toSelector(LocationHelpers.java:88)
    at io.appium.uiautomator2.handler.FindElement.findElement(FindElement.java:144)
    at io.appium.uiautomator2.handler.FindElement.safeHandle(FindElement.java:75)
    at io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:37)
    at io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:250)
    at io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:241)
    at io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:44)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)

* **元素信息:

{Using=-android uiautomator, value=new UiScrollable(new UiSelector()).scrollIntoView(new UiSelector().text(" val "));}

Appium日志:

1 个答案:

答案 0 :(得分:0)

在使用adb运行测试之前重新启动adb kill-server; adb start-server。 因为有时appium服务器的adb出现问题,所以通过重新启动可以避免此问题,并非每次出现此错误时都可以再次执行,如果没有解决,请重新启动adb,然后开始执行脚本将工作.. 乐意效劳... 如果您有任何疑问,请在下面留言。