# convenience method added to Appium (NOT Selenium 3)
def drag_and_drop(self, origin_el, destination_el):
"""Drag the origin element to the destination element
:Args:
- originEl - the element to drag
- destinationEl - the element to drag to
"""
action = TouchAction(self)
action.long_press(origin_el).move_to(destination_el).release().perform()
return self
# convenience method added to Appium (NOT Selenium 3)
def tap(self, positions, duration=None):
"""Taps on an particular place with up to five fingers, holding for a
certain time
:Args:
- positions - an array of tuples representing the x/y coordinates of
the fingers to tap. Length can be up to five.
- duration - (optional) length of time to tap, in ms
:Usage:
driver.tap([(100, 20), (100, 60), (100, 100)], 500)
"""
if len(positions) == 1:
action = TouchAction(self)
x = positions[0][0]
y = positions[0][1]
if duration:
duration = duration
action.long_press(x=x, y=y, duration=duration).release()
else:
action.tap(x=x, y=y).release()
action.perform()
else:
ma = MultiAction(self)
for position in positions:
x = position[0]
y = position[1]
action = TouchAction(self)
if duration:
duration *= 1000 # we take seconds, but send milliseconds
action.long_press(x=x, y=y, duration=duration).release()
else:
action.press(x=x, y=y).release()
ma.add(action)
ma.perform()
return self
# convenience method added to Appium (NOT Selenium 3)
def swipe(self, start_x, start_y, end_x, end_y, duration=None):
"""Swipe from one point to another point, for an optional duration.
:Args:
- start_x - x-coordinate at which to start
- start_y - y-coordinate at which to end
- end_x - x-coordinate at which to stop
- end_y - y-coordinate at which to stop
- duration - (optional) time to take the swipe, in ms.
:Usage:
driver.swipe(100, 100, 100, 400)
"""
# `swipe` is something like press-wait-move_to-release, which the server
# will translate into the correct action
action = TouchAction(self)
action \
.press(x=start_x, y=start_y) \
.wait(ms=duration) \
.move_to(x=end_x, y=end_y) \
.release()
action.perform()
return self
空指针异常~
链接已更新~
贴代码以及你的项目目录组织
楼主的头像稍微有点熟悉了。。
#3 楼 @seveniruby 哦!?我看看~
#32 楼 @seveniruby 原来是指这个~
#27 楼 @seveniruby 多元化是指?
#1 楼 @lihuazhang 是的,我正在准备写(一)的扩展篇,甚至是下面这些罗列的所有 find 方法,都细写一下
看楼主对 pyqt 颇有实战经验,来参加我的一个项目吧 ! https://github.com/qddegtya/PyQtLab
#6 楼 @seveniruby 楼主思路清晰,喜欢折腾,精通 GUI 编程,写工具杠杠的啊。。。
calabash 还是有很多坑值得总结的,楼主写一篇连贯的详细篇吧。
pyqt 打包一下吧~
UIAutomator 的翻版么?哈哈......大力支持!
我在真机上试验了一下,真机上嗅探出来的是一个整体 webview