import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import com.jiubei.baseinterface.BaseExecuteInterface; import io.appium.java_client.TouchAction;
import io.appium.java_client.android.AndroidDriver; import java.io.File;
import java.io.IOException;
import java.net.URL; import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities; /*
* jar使用的是java-client-5.0.3版本的,所以老版本的swipe方法是不能使用的!
* sleep_own()是自己封装的,读者可自行封装一个!
*
*/ public class Login extends KeyClass implements BaseExecuteInterface{
public Login(){} public AndroidDriver<WebElement> driver;
public final String up = "up";
public final String down="down";
public final String left="left";
public final String right="right"; public void direct_slide_f(String direct){
TouchAction touchAction =new TouchAction(driver);
if(direct.equals(this.getUp())){ touchAction.longPress(360, 720).moveTo(360, 600).release().perform();
System.out.println(up);
sleep_own(3);
}else if(direct.equals(this.getDown())){
//TouchAction touchAction =new TouchAction(driver);
touchAction.longPress(360, 600).moveTo(360, 720).release().perform();
sleep_own()(3);
}else if(direct.equals(this.getRight())){
//TouchAction touchAction =new TouchAction(driver);
touchAction.longPress(360, 600).moveTo(460, 600).release().perform();
sleep_own()(3);
}else if(direct.equals(this.getLeft())){
//TouchAction touchAction =new TouchAction(driver);
touchAction.longPress(460, 600).moveTo(360, 600).release().perform();
sleep_own()(3);
}else {
System.out.println("参数错误");
sleep_own(3);
}
} }

赋上maven的pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <groupId>com.yuedu</groupId>
<artifactId>pineapple</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging> <name>pineapple</name>
<url>http://maven.apache.org</url> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> <dependencies>
<!-- dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
-->
<!-- <dependency>
<groupId>io</groupId>
</dependency> -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>LATEST</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>LATEST</version>
<exclusions>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>LATEST</version>
</dependency>
</dependencies> </project>

随便建了个群:219537016,有问题可以往里抛,估计也解决不了!qinjian!

最新文章

  1. ffmpeg 音频转换(amr2mp3)
  2. bind_module和DEFAULT_MODULE
  3. 用Unity写一个12306验证器的恶搞图生成软件
  4. IOS第15天(3,事件处理,手势处理)
  5. Quartus调用modelsim
  6. Android Studio上方便使用butterknife注解框架的偷懒插件Android Butterknife Zelezny
  7. UIWebView swift
  8. 从UIImage的矩阵变换看矩阵运算的原理
  9. Ant学习总结2
  10. .net 平台下, Socket通讯协议中间件设计思路(附源码)
  11. jQuery系列 第八章 jQuery框架Ajax模块
  12. js如何判断数字是否有小数
  13. redis----------基本命令使用
  14. 超简DbHelper
  15. 20165325 2017-2018-2 《Java程序设计》结对编程_第一周:四则运算
  16. output.php
  17. 《linux/unix设计思想》读后感
  18. 转:CRF++
  19. iOS transform解决连续多次旋转缩放,实现图片旋转缩放效果
  20. tar包解压后用户名改变

热门文章

  1. Spring【依赖注入】就是这么简单
  2. .NET Core 配置Configuration杂谈
  3. 推荐一款有趣的APP-种子习惯
  4. Session和Cookie总结
  5. flask项目部署到阿里云 ubuntu16.04
  6. NancyFX 第九章 Responses(响应对象)
  7. 本站已稳定运行了XX天,网页时间显示功能实现方法
  8. Unity3D相机震动效果
  9. openstack中的环境准备
  10. centos7上安装0penStack