小肥羊要进步

Appium常用API 02

1.getPageSource

得到当前也页面的dom结构,可以用于断言当前页面是否有某个元素,或者判断当前页面有没有产生变化:如上下判断是否已经到了底端/顶端

//3.getPageSource
   String pageSource = androidDriver.getPageSource();
   System.out.println(pageSource);
   

2.获取当前页面类名currentActivity

 

 

 

验证一下:

 

 

3.resetApp

重置应用得数据

有些场景我们需要清除应用的数据,相当于第一次安装时候得状态,比如:第一次启动app的引导页,登录等等

 

4.isAppInstalled

判断App是否安装

 

 

 

5.pressKey

KeyEvent keyEvent = new KeyEvent();

keyEvent.withKey(AndroidKey.HOME);

androidDriver.pressKey(keyEvent);

 

posted on 2020-03-10 20:04  小肥羊要进步  阅读(157)  评论(0编辑  收藏  举报

导航