无法点击自动化,因为 IU 在 appium 中不正确可见。
请帮我解决这个问题。屏幕截图如下 附上的Appium 图像
Appium 版本:- 1.15.0 -1。
Java客户端:-java-client-7.2.0
appium 查看器所需的功能详细信息:-
{
"deviceName": "moto",
"udid": "ZF6222BQKC",
"platformVersion": "8.0.0",
"automationName": "UiAutomator2",
"autoGrantPermissions": true,
"appActivity": "com.xyz.eapp.eapp",
"appPackage": "com.xyz.eapp",
"platformName": "Android"
}
通过eclipse的命令: -
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "8.0.0");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "moto");
capabilities.setCapability(MobileCapabilityType.UDID, "ZF6222BQKC");
capabilities.setCapability("automationName", "UiAutomator2");
capabilities.setCapability("appPackage", "com.xyz.eapp");
capabilities.setCapability("appActivity", "com.xyz.eapp.eapp");
capabilities.setCapability("autoGrantPermissions",true);
capabilities.setCapability("unicodeKeyboard", true);
capabilities.setCapability("resetKeyboard", true);
capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, "3000");
capabilities.setCapability("noReset", true);
capabilities.setCapability("fullReset", false);
//capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
AndroidDriver<AndroidElement> driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS);
driver.findElementByAndroidUIAutomator("new UiSelector().text(\"Protection Solution\")").click();
Appium 的日志:-
[info] [35m[HTTP][39m [90m{"using":"-android uiautomator","value":"new UiSelector().text(\"Protection Solution\")"}[39m
[debug] [35m[W3C (fb2a594c)][39m Calling AppiumDriver.findElement() with args: ["-android uiautomator","new UiSelector().text(\"Protection Solution\")","fb2a594c-c0c7-4f2d-9c52-4661a74fcb1d"]
[debug] [35m[BaseDriver][39m Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [35m[BaseDriver][39m Waiting up to 50000 ms for condition
[debug] [35m[WD Proxy][39m Matched '/element' to command name 'findElement'
[debug] [35m[WD Proxy][39m Proxying [POST /element] to [POST http://localhost:8200/wd/hub/session/341338f5-760f-43cd-a763-f5fd07f9633f/element] with body: {"strategy":"-android uiautomator","selector":"new UiSelector().text(\"Protection Solution\")","context":"","multiple":false}
[info] [35m[WD Proxy][39m Got an unexpected response with status 404: {"sessionId":"341338f5-760f-43cd-a763-f5fd07f9633f","value":{"error":"no such element","message":"An element could not be located on the page using the given search parameters","stacktrace":"io.appium.uiautomator2.common.exceptions.ElementNotFoundException: An element could not be located on the page using the given search parameters\n\tat io.appium.uiautomator2.handler.FindElement.safeHandle(FindElement.java:78)\n\tat io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:38)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:252)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:242)\n\tat io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:44)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)\n\tat io.netty.chann...
[debug] [35m[W3C][39m Matched W3C error code 'no such element' to NoSuchElementError
请帮我解决这个问题。