![](/img/trans.png)
[英]How to do vertical scrolling in Android app using Python-Appium client
[英]How to do touch and hold in iOS app using Python client for Appium
我们正在尝试使用Appium python客户端为我们的iOS应用程序编写自动化测试。 我们想模仿一个元素上的Swipe事件,但appium.webdriver.common.touch_action中的API似乎都没有按照我们想要的方式运行。 基本上我们想要在三个事件(KEYDOWN,MOVE,KEYUP)中细分滑动。 流程如下
释放元素。 (KEYUP)
我们使用monkeyrunner在Android上工作。 它的工作原理如下
X=50
Y=50
hr = MonkeyRunner.waitForConnection(timeout = 60, deviceId = dev_2)
hr.touch(X, Y,MonkeyDevice.DOWN)
for i in range(1, 13):
hr.touch(X, Y + 20*i, hr.MOVE)
time.sleep(0.1)
MonkeyRunner.sleep(2)
// Do something
hr.touch(X, Y, MonkeyDevice.UP)
谢谢!
尝试使用TouchAction类。
elem = self.driver.find_element_by_css_selector(“something”)self.touch.tap(elem).Longpress()。moveto()。perform()
它正在使用触摸动作类为我工作:
TouchAction touchAction = new TouchAction(wd);
touchAction.longPress(webElement).waitAction().moveTo(x,y).release();
touchAction.perform();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.