Android 现在我能两点之间的滑动,但是如果要连续绘制几个点怎么办呢?如下图这种情况,至少连续绘制 4 个点
@lihuazhang
@monkey
@seveniruby
@ 各位大神
TouchAction(driver).press(x, y).move_to(x, y).move_to(x, y).move_to(x, y).release().perform()
@vicki 通过 class 可以找到,使用 find_elements_by_class_name 方法,会返回包含所有相同的 class name 的元素的一个列表,再通过索引获取列表中的元素。
@vicki 不是用这里面的 id
mark,随便学习!
我也是用了这个方法
new TouchAction(driver).press(startX+ 2*stepX, startY).moveTo(startX+2*stepX, startY+ stepY).release().perform();
但是没有成功 能帮我看下什么原因吗。
debug: Responding to client with success: {"status":0,"value":null,"sessionId":"fd7369ec-e21e-49e1-8683-58e83f5990ea"}
debug: Appium request initiated at /wd/hub/session/fd7369ec-e21e-49e1-8683-58e83f5990ea/touch/perform
debug: Request received with params: {"actions":[{"options":{"x":160,"y":549},"action":"press"},{"options":{"x":560,"y":549},"action":"moveTo"}]}
debug: Pushing command to appium work queue: ["element:touchDown",{"x":160,"y":549}]
debug: [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:touchDown","params":{"x":160,"y":549}}
debug: [BOOTSTRAP] [debug] Got command of type ACTION
debug: [BOOTSTRAP] [debug] Got command action: touchDown
debug: Pushing command to appium work queue: ["element:touchMove",{"x":560,"y":549}]
debug: [BOOTSTRAP] [debug] Performing TouchDown using element? false x: 160, y: 549
debug: [BOOTSTRAP] [debug] Updating class "class com.android.uiautomator.core.UiDevice" to enable field "mUiAutomationBridge"
debug: [BOOTSTRAP] [debug] Updating class "class com.android.uiautomator.core.UiAutomatorBridge" to enable field "mInteractionController"
debug: [BOOTSTRAP] [debug] Finding methods on class: class com.android.uiautomator.core.InteractionController
debug: [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}
debug: [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:touchMove","params":{"x":560,"y":549}}
debug: [BOOTSTRAP] [debug] Got command of type ACTION
debug: [BOOTSTRAP] [debug] Got command action: touchMove
debug: [BOOTSTRAP] [debug] Performing TouchMove using element? false x: 560, y: 549
#16 楼 @pianai 我之前也是用的 swipe 也是不行,但是不知道为什么,后来我这样写的,就可以了 JavascriptExecutor js = (JavascriptExecutor) dr;
HashMap swipeObj = new HashMap();
swipeObj.put("startX", 420.0);
swipeObj.put("startY", 400.00);
swipeObj.put("endX", 30.0);
swipeObj.put("endY", 400.0);
swipeObj.put("duration", 0.4);
// 滑动
for (int i = 0; i < 3; i++) {
try {
js.executeScript("mobile: swipe", swipeObj);
} catch (WebDriverException ex) {
ex.printStackTrace();
}
}
大哥们 为啥我用 Touchaction 只能点到相应的坐标点,但是不能滑动呢?
def test_gestureUnlock(self):
#time.sleep(5)
el1 = self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIAButton[10]")
print el1
time.sleep(2)
el2 = self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIAButton[13]")
print el2
time.sleep(2)
el3 = self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIAButton[16]")
print el3
time.sleep(2)
el4 = self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIAButton[17]")
print el4
time.sleep(2)
Gesture = TouchAction().press(el1).move_to(el2).move_to(el3).move_to(el4).release()
print Gesture
time.sleep(2)
Gesture.perform()
请问 手势密码这一段有什么问题啊 一直提示如下错误:
File "/Library/Python/2.7/site-packages/appium/webdriver/common/touch_action.py", line 94, in perform
self._driver.execute(Command.TOUCH_ACTION, params)
AttributeError: 'NoneType' object has no attribute 'execute'