【发布时间】:2019-08-04 06:50:29
【问题描述】:
我正在尝试在 iOS 模拟器上使用 Appium 1.11.1 进行一些 UITests 并且 Swipe 不起作用
driver connexion 看起来不错。我可以测试 driver.reloadApp() 并且它正在工作
我尝试了一些在堆栈溢出中发现的有关 TouchActions 的示例
public static void swipeHorizontal(MobileDriver driver, double startPercentage, double finalPercentage, int duration) throws Exception {
Dimension size = driver.manage().window().getSize();
int height = (int) (size.height/2);
int startPoint = (int) (size.getWidth() * startPercentage);
int endPoint = (int) (size.getWidth() * finalPercentage);
new TouchAction(driver).press(new PointOption().point(height, startPoint)).waitAction(new WaitOptions().waitOptions(Duration.ofMillis(duration))).moveTo(new PointOption().point(height, endPoint)).release().perform();
}
@Test.....{
swipeHorizontal(driver, 0.80, 0.20, 5);
}
测试通过了,但屏幕上什么也没有发生
我也试过这个解决方案https://stackoverflow.com/a/50388361/7406696,但它不适用于我的模拟器
我的 pom.xml 就是这个
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>5.0.4</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<scope>test</scope>
</dependency>
</dependencies>
【问题讨论】:
标签: selenium appium appium-ios xcuitest