4.微信小程序自动化
由于腾讯系QQ、微信是基于腾讯自研X5内核,不是谷歌原生webview,所以调试会有些许差异(有很多app厂商也开始采用X5内核
微信小程序只能够支持手机,模拟器是不行的
1:打开微信小程序webvie...
阅读全文运维 kubernetes docker ELK 安全 Nginx Mysql
由于腾讯系QQ、微信是基于腾讯自研X5内核,不是谷歌原生webview,所以调试会有些许差异(有很多app厂商也开始采用X5内核
微信小程序只能够支持手机,模拟器是不行的
1:打开微信小程序webvie...
阅读全文webview:Android系统控件、用来展示web页面、再系统中作为单独的系统应用存在
Hybrid应用自动化实现
基于UIAutomator+ChromeDrive
native部分走UIAutom...
阅读全文一、手势操作-滑动
下拉刷新
//下拉刷新-向下滑动//按住起始点->滑动到终止点位置上->手指抬起TouchActiontouchAction=newTouchAction(driver);//起始点PointOptionstartPoint=PointOption.point(424,632);//终止点PointOptionendPoint=PointOption.point(424,1000);//设置滑动时间-waitOptions类型的参数WaitOptionswaitOptions=WaitOptions.waitOptions(Duration.ofMillis(1000));touchAction.press(startPoint).waitAction(waitOptions).moveTo(endPoint).release().perform();/***向下滑动的通用封装*@paramswipeTime滑动时间*/publicstaticvoidswipeDown(longswipeTime){//约定滑动起始点与终止点的位置//滑动起始点:1/2宽度1/4高度滑动终止点:1/2宽度3/4高度intscreenWidth=driver.manage().window().getSize().getWidth();intscreenHeight=driver.manage().window().getSize().getHeight();TouchActiontouchAction=newTouchAction(driver);//起始点(424,632)PointOptionpointOptionA=PointOption.point(screenWidth/2,screenHeight/4);//终止点(424,1000)PointOptionpointOptionB=PointOption.point(screenWidth/2,screenHeight*3/4);//设置滑动时间-waitOptions类型的参数WaitOptionswaitOptions=WaitOptions.waitOptions(Duration.ofMillis(swipeTime));touchAction.press(pointOptionA).waitAction(waitOptions).moveTo(pointOptionB).release().perform();}/***向上滑动的通用封装*@paramswipeTime滑动时间*/publicstaticvoidswipeUp(longswipeTime){//约定滑动起始点与终止点的位置//滑动起始点:1/2宽度1/4高度滑动终止点:1/2宽度3/4高度intscreenWidth=driver.manage().window().getSize().getWidth();intscreenHeight=driver.manage().window().getSize().getHeight();TouchActiontouchAction=newTouchAction(driver);//起始点(424,632)PointOptionpointOptionA=PointOption.point(screenWidth/2,screenHeight*3/4);//终止点(424,1000)PointOptionpointOptionB=PointOption.point(screenWidth/2,screenHeight/4);//设置滑动时间-waitOptions类型的参数WaitOptionswaitOptions=WaitOptions.waitOptions(Duration.ofMillis(swipeTime));touchAction.press(pointOptionA).waitAction(waitOptions).moveTo(pointOptionB).release().perform();}/***向左滑动的通用封装*@paramswipeTime滑动时间*/publicstaticvoidswipeLeft(longswipeTime){//约定滑动起始点与终止点的位置//滑动起始点:1/2宽度1/4高度滑动终止点:1/2宽度3/4高度intscreenWidth=driver.manage().window().getSize().getWidth();intscreenHeight=driver.manage().window().getSize().getHeight();TouchActiontouchAction=newTouchAction(driver);//起始点(424,632)PointOptionpointOptionA=PointOption.point(screenWidth*3/4,screenHeight/2);//终止点(424,1000)PointOptionpointOptionB=PointOption.point(screenWidth/4,screenHeight/2);//设置滑动时间-waitOptions类型的参数WaitOptionswaitOptions=WaitOptions.waitOptions(Duration.ofMillis(swipeTime));touchAction.press(pointOptionA).waitAction(waitOptions).moveTo(pointOptionB).release().perform();}/***向右滑动的通用封装*@paramswipeTime滑动时间*/publicstaticvoidswipeRight(longswipeTime){//约定滑动起始点与终止点的位置//滑动起始点:1/2宽度1/4高度滑动终止点:1/2宽度3/4高度intscreenWidth=driver.manage().window().getSize().getWidth();intscreenHeight=driver.manage().window().getSize().getHeight();TouchActiontouchAction=newTouchAction(driver);//起始点(424,632)PointOptionpointOptionA=PointOption.point(screenWidth/4,screenHeight/2);//终止点(424,1000)PointOptionpointOptionB=PointOption.point(screenWidth*3/4,screenHeight/2);//设置滑动时间-waitOptions类型的参数WaitOptionswaitOptions=WaitOptions.waitOptions(Duration.ofMillis(swipeTime));touchAction.press(pointOptionA).waitAction(waitOptions).moveTo(pointOptionB).release().perform();}//场景:滑动到页面底部driver.findElement(By.id("com.lemon.lemonban:id/navigation_tiku")).click();driver.findElement(By.id("com.lemon.lemonban:id/button_go_login")).click();driver.findElement(By.id("com.lemon.lemonban:id/et_mobile")).sendKeys("13323234545");driver.findElement(By.id("com.lemon.lemonban:id/et_password")).sendKeys("234545");driver.findElement(By.id("com.lemon.lemonban:id/btn_login")).click();driver.findElement(MobileBy.AndroidUIAutomator("newUiSelector().text(\"软件测试基础\")")).click();driver.findElement(By.id("com.lemon.lemonban:id/first_level")).click();Thread.sleep(3000);//循环滑动while(true){//滑动前的页面源代码StringbeforeSource=driver.getPageSource();swipeUp(1000);Thread.sleep(1000);//什么时候跳出循环呢?//1、等待【全部加载完成】出来之后?缺点:(1)必须要保证此元素要立马出来(2)有些页面没有这个提示//通过getPageSource进行判断/*if(driver.getPageSource().contains("全部加载完成")){break;}*///2、getPageSource,通过滑动前后页面的pageSource是不是发生变化//滑动之后的页面源代码StringafterSource=driver.getPageSource();if(afterSource.equals(beforeSource)){//滑动到了页面的底部break;}}
二、特殊场景元素定位
1.toast元素定位
Android中的Toast是一种简易的消息提示框,当视图显示给用户,在应用程序中显示为浮动和Dialog不一样的是,它永远不会获得...
阅读全文一、App前端基础知识
1.App类型划分
2.App类型对比
应用类型 | 优点 | 缺点 |
Nativ | 直接依托于操作系统、交互性强、性能最好、功能最为强大 | 开发成本高、无法跨平台、更新缓慢、审核周期慢、维护成本高 |
we |
Appium同时支持Android & IOS,windows只能支持Android,mac既可以支持Android也可以支持IO
一、准备手机模拟器
下载地址:https://www.yeshen.com...
阅读全文