我在新的TouchActions课程中遇到错误.
TouchActions actions = new TouchActions(appiumDriver);
Run Code Online (Sandbox Code Playgroud)
运行时错误:
java.lang.ClassCastException:io.appium.java_client.ios.IOSDriver无法强制转换为org.openqa.selenium.interactions.HasTouchScreen
然而,旧的以下工作都很好:
TouchAction touchAction = new TouchAction(appiumDriver);
Run Code Online (Sandbox Code Playgroud)
小智 1
使用io.appium.java_client.TouchAction类。
步骤1
TouchAction action = new TouchAction(driver);
Run Code Online (Sandbox Code Playgroud)
这driver是 的一个实例AppiumDriver。
第2步
WebElement ele = driver.findElement(By.id("locator"));
action.tap(new TapOptions().withElement(new ElementOption().withElement(ele))).perform();
Run Code Online (Sandbox Code Playgroud)
使用新的实现,TouchAction您无法直接传递 webment。
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.0.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4749 次 |
| 最近记录: |