Appium 1.7 实现上下、左右滑动页面方法
来源:互联网 发布:网络常见的拓扑形式有 编辑:程序博客网 时间:2024/06/08 11:20
Appium 1.7 实现上下、左右滑动页面方法
说明:之前的文章:Appium 实现上下、左右滑动页面 只适用于Appium 1.6.4及以下
Appium升级到1.7 后的问题:
(1)以前的driver.swipe方法不能用了。
(2)即便使用TouchAction类的滑动方法也不能用了,因为waitAction有变化(waitAction(Duration)注意 这里表是Duration对象,而不是以前直接的数字,如waitAction(1000))。
解决方法:
新建类:SwipeScreen.java
import java.time.Duration;import io.appium.java_client.TouchAction;import io.appium.java_client.android.AndroidDriver;public class SwipeScreen{ static Duration duration=Duration.ofSeconds(1);public static void swipeUp(AndroidDriver driver) { int width = driver.manage().window().getSize().width; int height = driver.manage().window().getSize().height; TouchAction action1 = new TouchAction(driver).press(width / 2,height * 4/ 5).waitAction(duration).moveTo(width /2, height /4).release(); action1.perform(); } public static void swipeDown(AndroidDriver driver)// scroll down to refresh { int width = driver.manage().window().getSize().width; int height = driver.manage().window().getSize().height; TouchAction action1 = new TouchAction(driver).press(width / 2,height/4).waitAction(duration).moveTo(width /2, height* 3/4).release(); action1.perform(); } public static void swipeLeft(AndroidDriver driver) { int width = driver.manage().window().getSize().width; int height = driver.manage().window().getSize().height; TouchAction action1 = new TouchAction(driver).press(width -10,height/2).waitAction(duration).moveTo(width /4, height /2).release(); action1.perform(); } public static void swipeRight(AndroidDriver driver) { int width = driver.manage().window().getSize().width; int height = driver.manage().window().getSize().height; TouchAction action1 = new TouchAction(driver).press(10,height/2).waitAction(duration).moveTo(width *3/4+10, height /2).release(); action1.perform(); }}
使用方法:
SwipeScreen.swipeUp(driver);
阅读全文
1 0
- Appium 1.7 实现上下、左右滑动页面方法
- Appium 测试,实现上下、左右滑动页面【Android,iOS 已验证】
- Appium左右、上下滑动(Java)
- CSS3实现上下滑动和左右摆动
- GestureDetector学习之左右滑动,上下滑动屏幕切换页面
- 左右上下滑动表格
- 用JS 这些实现左右滑动 上下滑动
- Android 自定义View 实现手势监听,左右滑动,上下滑动
- js实现页面左右上下拖拽
- Appium 测试,实现上下左右滑动页面
- Axure8.0 页面上下滑动效果实现
- Android实现Excel表格,且表格能左右、上下滑动
- ViewPager结合Fragment实现页面左右滑动
- TabActivity实现手指左右滑动切换页面
- AppBarLayout、ViewPager、Fragment实现页面左右滑动
- Viewpager+Fragment实现左右滑动切换页面
- Appium页面滑动问题
- android SlidingDrawer左右滑动 上下滑动
- 虚拟机网络无法连接
- Ubuntu14.04下 cmake升级 试过两种办法,
- 个人计划《2017-10-07》
- MD5 密码加密
- HYSBZ4154-Generating Synergy
- Appium 1.7 实现上下、左右滑动页面方法
- Codeforces Round #439 (Div. 2) The Artful Expedient
- PCB布线FORTRAN程序例子2
- v8 引擎与javascript代码优化
- 数位dp
- Python中的整除
- LeetCode
- weblogic配置JDBC数据源(mysql)
- Java:如何检测一个链表是否有环。