Skip to content

在vivo x9,Android系统版本为7.1.2上,存在使用问题 #8

Description

@zhechengmao

在该机型上,脚本中使用该代码driver.elementByXPath(”******“).click();,会报空指针异常
2019-03-28 14:18:39 Request:http://localhost:3456/wd/hub/session/9d146aed-bf8d-42a7-a6b3-d4748a6bd1d6/element:{"using":"xpath","value":"//android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.support.v4.widget.DrawerLayout[1]/android.widget.RelativeLayout[1]/android.widget.FrameLayout[1]/android.widget.RelativeLayout[1]/android.widget.RelativeLayout[2]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.TextView[1]"}
2019-03-28 14:18:39 Response:{"status":0,"value":{"ELEMENT":"1"},"sessionId":"9d146aed-bf8d-42a7-a6b3-d4748a6bd1d6"}
2019-03-28 14:18:39 Request:http://localhost:3456/wd/hub/session/9d146aed-bf8d-42a7-a6b3-d4748a6bd1d6/element/1/click:{}
2019-03-28 14:18:40 Response:{"status":7,"value":"An element could not be located on the page using the given search parameters.","sessionId":"9d146aed-bf8d-42a7-a6b3-d4748a6bd1d6"}

java.lang.NullPointerException
at macaca.client.common.Utils.deleteRequest(Utils.java:125)
at macaca.client.common.Utils.request(Utils.java:142)
at macaca.client.commands.Session.delSession(Session.java:50)
at macaca.client.MacacaClient.quit(MacacaClient.java:1209)
at com.javademo.cases.Login.tearDown(Login.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
使用坐标点击,同样如此

换成华为机器,该问题得以解决。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions