appium 学习太痛苦了,求 python 版 mobile gestures sample code。。。mobile: flick.....
代码如下,就是在起 app 的时候有几页欢迎界面,需要手划动去,我用 flick 去试试,但是不行,一个界面就是一个 imageview.
import os
import glob
import unittest, time, re
from time import sleep
from selenium import webdriver
desired_caps = {}
desired_caps['device'] = 'selendroid'
desired_caps['browserName'] = ''
desired_caps['version'] = '4.2'
desired_caps['app'] = "C:\Users\I072687\Desktop\AppiumForWindows-0.12.3\webviewtest.apk"
desired_caps['app-package'] = 'test.sfa.container'
desired_caps['app-activity'] = '.SplashScreenActivity'
driver = webdriver.Remote('http://localhost:4723/wd/hub,desired_caps')
#time.sleep(10)
welcomeimage=driver.find_elements_by_tag_name('ImageView')[0]
#driver.execute_script("mobile: ", {"touchCount":"1", "endX":"-100", "endY":"0", "element":welcomeimage})
flick = webdriver.TouchActions(driver).flick_element(welcomeimage, -150, 0, 3)
flick.perform()
time.sleep(10)
driver.quit()
appium log:
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/sessio
n/a57b48a8-d078-4ed5-8959-9f8e1495f802/touch/flick","method":"POST","json":{"ses
sionId":"a57b48a8-d078-4ed5-8959-9f8e1495f802","element":"90edcff6-a78b-4044-905
6-4871c0c74e0b","speed":3,"xoffset":-150,"yoffset":0}}
debug: Proxied response received with status 200: {"value":"","status":0,"sessio
nId":"a57b48a8-d078-4ed5-8959-9f8e1495f802"}
POST /wd/hub/session/a57b48a8-d078-4ed5-8959-9f8e1495f802/touch/flick 200 77ms -
87b
debug: Appium request initiated at /wd/hub/session/a57b48a8-d078-4ed5-8959-9f8e1
495f802
debug: Request received with params: {}
#3 楼 @seveniruby 刚开始试用,很不熟悉,很多接口也不知道怎么写。。。
可以看看这个帖子 http://testerhome.com/topics/201
#6 楼 @xiaomayi0323 我感觉有很多坑啊,我试着把 device 改成 android 就有效果,那说明 selendroid 支持很弱啊,但是看 selendroid 官方又是说支持的,奶奶的。。。无限多坑
#9 楼 @seveniruby 恩是的,所以说 appium 对支持 hrbrid app 实在太有限了。。。
#11 楼 @seveniruby 恩,他整合的 selenroid 框架好像不太行,文档 api,sample code 几乎也没有,很难入手
执行 swipe 操作 出现错误:
An unknown server-side error occurred while processing the command.
self.driver.execute_script("mobile: swipe",
{"touchCount": 1, "startX": 157, "startY": 529, "endX": 156, "endY": 102, "duration": 0.5}) 怎么回事?
@seveniruby 谢谢啦。。