对于某些元素,Appium无法提供交互操作相关的方法,比如TextView、Label等只读元素。当使用Appium尝试操作这些元素时,就会出现“appium-Interactions are not available for this element”的提示。 如果需要操作这些元素,可以使用Appium的TouchActions或Tap方法来模拟点击操作。例如:对于如下的TextView元素,可以使用Tap方法模拟点击操作。
driver.findElementByName("TextView").click();
改成:
WebElement textViewElement = driver.findElementByName("TextView");
TouchActions ta = new TouchActions(driver);
ta.singleTap(textViewElement).perform();
这样,就可以在TextView元素上执行单击操作了。
上一篇:appium-dotnet-driver是否支持.NET Core 2.x?
下一篇:Appium-Python客户端的TouchAction类正在被弃用。我该如何执行press()、long_press()操作?