feat: support w3c actions and velocity swipe#160
Conversation
|
Also documented |
|
Added support for |
|
今天早上review了一下,在想是否真的需要这么多的类(TouchTap, TouchLongPress,TouchPress,TouchMovement,FingerMovement) 我构思了一下,下面的方法是否可行呢。去掉这些类,直接把值传过去。功能效果一样,代码确更少了。 FingerAction().move(x, y).down.pause(0.1).up()
TouchActions().press(x, y, pressure=1).pause(.1).up() # 补充疑问,为什这里是.. Actions,而上面是..Action |
|
need a little update |
不愧是蓝哥, 这么优雅 |
确实在类的实现上面是有些冗余和重复了,下周 update 下 另,TouchActions 其实是为了对齐 W3CActions 的命名,不过 W3CActions 是多个 Actions 的并集,TouchAction 应该只对应一个滑动操作,这里应该确实是和 FingerAction 对齐会更好一些(?) |
其实我们封装代码的最终目的是为了更方便的去使用,如果增加了更多的类,却没有可读性和易用性的提升,其实类的封装反而是个累赘。没有必要完全对其,毕竟最终追求的是方便。 |
| Returns: | ||
| Self for method chaining | ||
| """ | ||
| if second < 0: |
There was a problem hiding this comment.
这段是有有必要,直接second<0抛出ValueError是否更好
| def swipe_with_velocity(self, x1: Union[int, float], y1: Union[int, float], x2: Union[int, float], y2: Union[int, float], | ||
| press_duration: float, hold_duration: float, velocity: float): | ||
| """ | ||
| Press down and drag with velocity, appium forked version of wda only |
Description
Since the
facebookarchive/WebDriverAgenthas been archived and the current maintained version is the Appium fork, there has been an increasing demand to utilize the new endpoints introduced in the Appium fork. Notably, the/actionsendpoint is now being used for complex touch operations.In response to this demand, I have made some minor adaptations to support these endpoints, specifically implementing support for
/actionsand/wda/pressAndDragWithVelocity.Changes
/actionsendpoint/wda/pressAndDragWithVelocityendpoint