- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试在 native iOS 应用程序中自动执行长按触摸操作。
方法一:模拟左上角长按,无效。
新的 TouchAction(driver).longPress(0,0).perform()
Appium 日志显示没有错误:
info: [debug] [INST] 2015-12-21 17:41:19 +0000 Debug: Got new command 5 from instruments: target.touch([{"touch":[{"x":0,"y":0}],"time":0.2}])
info: [debug] [INST] 2015-12-21 17:41:19 +0000 Debug: evaluating target.touch([{"touch":[{"x":0,"y":0}],"time":0.2}])
info: [debug] [INST] 2015-12-21 17:41:19 +0000 Debug: target.touch(__NSCFArray)
info: [debug] [INST] 2015-12-21 17:41:20 +0000 Debug: evaluation finished
info: [debug] [INST] 2015-12-21 17:41:20 +0000 Debug: responding with:
info: [debug] [INST] 2015-12-21 17:41:20 +0000 Debug: Running system command #6: /usr/local/Cellar/node/4.1.1/bin/node /usr/local/lib/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":""}...
info: [debug] Socket data received (25 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":""}
info: [debug] Responding to client with success: {"status":0,"value":"","sessionId":"332523ee-5a1b-427a-8beb-3c150587d08b"}
方法二:执行javascript模拟长按
((IOSDriver)driver).executeScript("mobile: longClick", ImmutableMap.of("x", 5, "y", 5));
Appium日志异常如下:
TypeError: cb is not a function
at [object Object].iOSController.touchLongClick (/usr/local/lib/node_modules/appium/lib/devices/ios/ios-controller.js:614:3)
at Object.exports.touchLongClick [as longClick] (/usr/local/lib/node_modules/appium/lib/server/controller.js:371:16)
at Object.exports.executeMobileMethod (/usr/local/lib/node_modules/appium/lib/server/controller.js:984:22)
at exports.execute (/usr/local/lib/node_modules/appium/lib/server/controller.js:940:15)
at Layer.handle [as handle_request] (/usr/local/lib/node_modules/appium/node_modules/express/lib/router/layer.js:82:5)
最佳答案
您必须将 2 个参数传递给 longPress() 方法。它们是您要保持的元素(下面代码中的元素)和时间(2000 毫秒)它必须保持多长时间。
MobileElement element = driver.findElementByClassName("xxx");
new TouchAction(driver).longPress(element, 2000).perform();
关于java - iOS + appium java 客户端 : Long press TouchAction does not work?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34401593/
我正在寻找使用最新(此时)Appium Java 客户端 6.1.0 创建 Tap/Swipe/Drag 等事件的“正确”或“最新”方式。 我在 Appium 站点( Tap using TouchA
我以前是这样做的:TouchAction t = new TouchAction(驱动程序); 但现在向我要泛型!还有一些方法已弃用,有人可以给我一个如何使用 java 在 appium 中实例化 T
我能够使用我通过触摸操作编写的滚动方法,但现在运行它时出现编译错误。我现在应该使用什么或者我可以做什么来解决编译问题? public void scrollDown() { AndroidDr
我在尝试使用滑动时遇到了错误,但它似乎已经过时了。建议使用 TouchAction(),但我不确定如何将滑动转换为 TouchAction()。 代码如下: public void obj_scrol
这里是移动自动化的新手。我正在尝试使用 Touch Action 执行以下代码来执行滑动操作以导航到第 2 页,但滑动不起作用。 AndroidDriver driver=new AndroidDri
And(/^I click OK button in popup$/) do #Appium::TouchAction.new.tap(x:0.64, y:0.57, count: 1).perf
Selenium ActionChains 模块能够移动到具有偏移量的元素(提供 x 和 y 坐标,如下所示):ActionChains(浏览器).move_to_element_with_offse
我正在使用多线程在多个android设备上运行并行测试。代码可以在没有多线程的情况下正常运行。我认为Appium:TouchAction存在一些同步问题。 这是我的代码: require 't
我有一个坐标字符串数组,其中数组中的每个字符串都分配给一个 int String[] A = {"217, 423", "557, 408", "927, 393"}; Random B=new Ra
我使用 touchstart 和 touchmove 事件编写了一些 Javascript 代码。我想用 Selenium 来测试它。我刚刚发现了TouchActions具有 move 方法的类似乎正
我正在尝试在 native iOS 应用程序中自动执行长按触摸操作。 方法一:模拟左上角长按,无效。 新的 TouchAction(driver).longPress(0,0).perform()Ap
我在向下滚动到 iOS 和 Android 应用程序中的某个元素时遇到问题。自从 Appium 1.6.3 更新到 1.7.1 以及 io.appium 更新到 6.1.0 以来,不推荐使用滑动方法,
我正在使用 appium 1.13.0 尝试使用此方法在 Android 8.1 上的三星 Galaxy Note 9 上滚动浏览 native Android 应用程序 new TouchActio
我正在通过 Nightwatch 和 Appium 运行一些测试,但我无法使用 iOS 模拟器成功实现滚动操作。我的测试设置为能够在 Chrome、Safari 或 Firefox 浏览器或使用 Sa
我的 Appium Java 代码: package Generic; import java.net.MalformedURLException; import java.net.URL; impo
返回错误:java.lang.SecurityException:在 appium 中使用 touchaction 类时注入(inject)到另一个应用程序需要 INJECT_EVENTS 权限 tr
我是一名优秀的程序员,十分优秀!