单击无法使用 appium 测试通过但未执行任何操作 [英] Click is not working with appium test is passing but no action is performed

查看:42
本文介绍了单击无法使用 appium 测试通过但未执行任何操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想点击退出按钮.我尝试过以下操作来执行点击操作

使用点击

 WebElement logOut = driver.findElementByName("注销");TouchAction act = new TouchAction(driver);act.tap(logOut, 1, 1);

简单的点击

WebElement logOut = driver.findElementByName("注销");登出.click();

TouchAction act = new TouchAction(driver);act.press(logOut).perform()

;

按其给予

处理命令时发生未知的服务器端错误.

也试过了

MobileElement logout = (MobileElement) driver.findElementByName("Log out");注销.tap(1, 10);

这给出了相同的未知服务器端错误

如果我在任何地方做错了,请告诉我.

提前致谢.

这是服务器日志

>info: [debug] [BOOTSTRAP] [debug] 使用 NAME 和 contextId 查找注销:multiple: false>信息:[debug] [BOOTSTRAP] [debug] 使用:UiSelector[DESCRIPTION=Log out, INSTANCE=0]>info: [debug] [BOOTSTRAP] [debug] 返回结果:{"status":0,"value":{"ELEMENT":"2"}}>信息:[调试] 成功响应客户端:{"status":0,"value":{"ELEMENT":"2"},"sessionId":"ad4afb54-6f6d-4a39-bb60-49e4cbbcc4bc"}>信息:<-- POST/wd/hub/session/ad4afb54-6f6d-4a39-bb60-49e4cbbcc4bc/element 200 44.615 ms - 87 {"status":0,"value":{"ELEMENT":"2"},"sessionId":"ad4afb54-6f6d-4a39-bb60-49e4cbbcc4bc"}>信息:-->POST/wd/hub/session/ad4afb54-6f6d-4a39-bb60-49e4cbbcc4bc/touch/perform {"actions":[{"action":"press","options":{"element":"2"}},{"action":"wait","options":{"ms":250}},{"action":"release","options":{}}]}>信息:[调试] 将命令推送到 appium 工作队列:["element:getLocation",{"elementId":"2"}]>信息:[调试] 将命令推送到 appium 工作队列:["element:getSize",{"elementId":"2"}]>info: [debug] [BOOTSTRAP] [debug] 从客户端得到数据:{"cmd":"action","action":"element:getLocation","params":{"elementId":"2"}}>info: [debug] [BOOTSTRAP] [debug] 得到了 ACTION 类型的命令>信息:[debug] [BOOTSTRAP] [debug] 得到命令动作:getLocation>信息:[debug] [BOOTSTRAP] [debug] 返回结果:{"status":0,"value":{"x":-256,"y":932}}>info: [debug] [BOOTSTRAP] [debug] 从客户端得到数据:{"cmd":"action","action":"element:getSize","params":{"elementId":"2"}}>info: [debug] [BOOTSTRAP] [debug] 得到了 ACTION 类型的命令>信息:[debug] [BOOTSTRAP] [debug] 得到命令动作:getSize>info: [debug] [BOOTSTRAP] [debug] 返回结果:{"status":0,"value":{"width":240,"height":81}}>信息:[调试] 将命令推送到 appium 工作队列:["element:getLocation",{"elementId":"2"}]>info: [debug] [BOOTSTRAP] [debug] 从客户端得到数据:{"cmd":"action","action":"element:getLocation","params":{"elementId":"2"}}>info: [debug] [BOOTSTRAP] [debug] 得到了 ACTION 类型的命令>信息:[debug] [BOOTSTRAP] [debug] 得到命令动作:getLocation>信息:[debug] [BOOTSTRAP] [debug] 返回结果:{"status":0,"value":{"x":-256,"y":932}}>信息:[调试] 将命令推送到 appium 工作队列:["element:getSize",{"elementId":"2"}]>info: [debug] [BOOTSTRAP] [debug] 从客户端得到数据:{"cmd":"action","action":"element:getSize","params":{"elementId":"2"}}>info: [debug] [BOOTSTRAP] [debug] 得到了 ACTION 类型的命令>信息:[debug] [BOOTSTRAP] [debug] 得到命令动作:getSize>info: [debug] [BOOTSTRAP] [debug] 返回结果:{"status":0,"value":{"width":240,"height":81}}>信息:[调试] 将命令推送到 appium 工作队列:["element:touchDown",{"elementId":"2","x":-136,"y":972.5}]>info: [debug] [BOOTSTRAP] [debug] 从客户端得到数据:{"cmd":"action","action":"element:touchDown","params":{"elementId":"2","x":-136,"y":972.5}}>info: [debug] [BOOTSTRAP] [debug] 得到了 ACTION 类型的命令>信息:[debug] [BOOTSTRAP] [debug] 得到命令动作:touchDown>信息:[debug] [BOOTSTRAP] [debug] 使用元素执行 TouchDown?真 x:-136,y:972>info: [debug] [BOOTSTRAP] [debug] 返回结果: {"status":13,"value":"Failed to execute touch event"}>信息:[调试] 响应客户端错误:{"status":13,"value":{"message":"处理命令时发生未知的服务器端错误.","origValue":"执行失败触摸事件"},"sessionId":"ad4afb54-6f6d-4a39-bb60-49e4cbbcc4bc"}>信息:<-- POST/wd/hub/session/ad4afb54-6f6d-4a39-bb60-49e4cbbcc4bc/touch/perform 500 211.167 ms - 198>信息:[调试] 60 秒内没有收到新命令,正在关闭...>信息:关闭 appium 会话>信息:[调试]按HOME键>info: [debug] 执行 cmd: C:\Users\fission\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s f547bbb6 shell "input keyevent 3">信息:[调试] 停止 logcat 捕获>信息:[调试] Logcat 终止,代码为空,信号 SIGTERM>信息:[debug] [BOOTSTRAP] [debug] 从客户端得到数据:{"cmd":"shutdown"}>info: [debug] [BOOTSTRAP] [debug] 得到了 SHUTDOWN 类型的命令>info: [debug] [BOOTSTRAP] [debug] 返回结果:{"status":0,"value":"OK,正在关闭"}>信息:[debug] [BOOTSTRAP] [debug] 关闭客户端连接>info: [debug] 发送关闭命令,等待 UiAutomator 停止...>信息:[调试] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS:numtests=1>信息:[调试] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS:流=.>信息:[调试] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS:id=UiAutomatorTestRunner>信息:[调试] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS:test=testRunServer>信息:[调试] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS:class=io.appium.android.bootstrap.Bootstrap>信息:[调试] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS:当前=1>信息:[调试] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE:0>信息:[调试] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS:流=>信息:[调试] [UIAUTOMATOR STDOUT] WatcherResultPrinter= 的测试结果.>信息:[调试] [UIAUTOMATOR STDOUT] 时间:82.744>信息:[debug] [UIAUTOMATOR STDOUT] OK(1 次测试)>信息:[调试] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE:-1>信息:[调试] [UIAUTOMATOR STDOUT] INSTRUMENTATION_RESULT:shortMsg=java.lang.SecurityException>info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_RESULT: longMsg=Permission Denial: getIntentSender() from pid=21860, uid=2000, (need uid=1000) is not allowed to send as package android

解决方案

如果您的点击事件不起作用,那么您的开发人员可能使用了诸如 patlab 之类的 API 而不是点击事件..

你应该咨询你的开发者他/她是否使用过 patlab 之类的 api

如果是,请向您的开发人员询问事件名称,您可以使用 jquery 触发

I want to click on logout button. I have tried following things to perform a click action

Using Tap

  WebElement logOut = driver.findElementByName("Log out");
            TouchAction act = new TouchAction(driver);
            act.tap(logOut, 1, 1);

Simple click

WebElement logOut = driver.findElementByName("Log out");
        logOut.click();

Press

TouchAction act = new TouchAction(driver);
        act.press(logOut).perform()

;

For Press its giving

An unknown server-side error occurred while processing the command.

Also tried

MobileElement logout = (MobileElement) driver.findElementByName("Log out");
        logout.tap(1, 10);

Which gives same unknown server-side error

Let me know if I am doing wrong anywhere.

Thanks in advance.

Here is server log

> info: [debug] [BOOTSTRAP] [debug] Finding Log out using NAME with the contextId:  multiple: false
> info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[DESCRIPTION=Log out, INSTANCE=0]
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":{"ELEMENT":"2"}}
> info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":"2"},"sessionId":"ad4afb54-6f6d-4a39-bb60-49e4cbbcc4bc"}
> info: <-- POST /wd/hub/session/ad4afb54-6f6d-4a39-bb60-49e4cbbcc4bc/element 200 44.615 ms - 87 {"status":0,"value":{"ELEMENT":"2"},"sessionId":"ad4afb54-6f6d-4a39-bb60-49e4cbbcc4bc"}
> info: --> POST /wd/hub/session/ad4afb54-6f6d-4a39-bb60-49e4cbbcc4bc/touch/perform {"actions":[{"action":"press","options":{"element":"2"}},{"action":"wait","options":{"ms":250}},{"action":"release","options":{}}]}
> info: [debug] Pushing command to appium work queue: ["element:getLocation",{"elementId":"2"}]
> info: [debug] Pushing command to appium work queue: ["element:getSize",{"elementId":"2"}]
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:getLocation","params":{"elementId":"2"}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: getLocation
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":{"x":-256,"y":932}}
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:getSize","params":{"elementId":"2"}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: getSize
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":{"width":240,"height":81}}
> info: [debug] Pushing command to appium work queue: ["element:getLocation",{"elementId":"2"}]
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:getLocation","params":{"elementId":"2"}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: getLocation
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":{"x":-256,"y":932}}
> info: [debug] Pushing command to appium work queue: ["element:getSize",{"elementId":"2"}]
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:getSize","params":{"elementId":"2"}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: getSize
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":{"width":240,"height":81}}
> info: [debug] Pushing command to appium work queue: ["element:touchDown",{"elementId":"2","x":-136,"y":972.5}]
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:touchDown","params":{"elementId":"2","x":-136,"y":972.5}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: touchDown
> info: [debug] [BOOTSTRAP] [debug] Performing TouchDown using element? true x: -136, y: 972
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":13,"value":"Failed to execute touch event"}
> info: [debug] Responding to client with error: {"status":13,"value":{"message":"An unknown server-side error occurred while processing the command.","origValue":"Failed to execute touch event"},"sessionId":"ad4afb54-6f6d-4a39-bb60-49e4cbbcc4bc"}
> info: <-- POST /wd/hub/session/ad4afb54-6f6d-4a39-bb60-49e4cbbcc4bc/touch/perform 500 211.167 ms - 198 
> info: [debug] Didn't get a new command in 60 secs, shutting down...
> info: Shutting down appium session
> info: [debug] Pressing the HOME button
> info: [debug] executing cmd: C:\Users\fission\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s f547bbb6 shell "input keyevent 3"
> info: [debug] Stopping logcat capture
> info: [debug] Logcat terminated with code null, signal SIGTERM
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"shutdown"}
> info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"OK, shutting down"}
> info: [debug] [BOOTSTRAP] [debug] Closed client connection
> info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
> info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
> info: [debug] [UIAUTOMATOR STDOUT] Time: 82.744
> info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_RESULT: shortMsg=java.lang.SecurityException
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_RESULT: longMsg=Permission Denial: getIntentSender() from pid=21860, uid=2000, (need uid=1000) is not allowed to send as package android

解决方案

If your click event is not working then probably your developer must have used some api like patlab instead of click event..

You should consult your developer whether he/she have used api like patlab or not

if so then ask your developer for the event name and you can trigger using jquery

这篇关于单击无法使用 appium 测试通过但未执行任何操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆