appium = 1.9.0
android设备
Windows 10
长按元素不起作用
我已经尝试过:
<MobileElement longpress = (MobileElement) new WebDriverWait(driver, 30).
until(ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("msgContent")));
new Actions(driver).clickAndHold(longpress).perform();
错误:
org.openqa.selenium.InvalidArgumentException:参数为 不正确我们想要{“ required”:[“ actions”]},然后您发送了[“ element”]
TouchAction action = new TouchAction(driver);
action.longPress((LongPressOptions) element).release().perform();
错误:
java.lang.ClassCastException:com.sun.proxy。$ Proxy16无法转换为 io.appium.java_client.touch.LongPressOptions
new TouchAction(driver).press(ElementOption.element(element)).waitAction(WaitOptions.waitOptions(Duration.ofSeconds(20))).release().perform();
错误:
java.lang.ClassCastException:无法将com.sun.proxy。$ Proxy16强制转换为 org.openqa.selenium.internal.HasIdentity
答案 0 :(得分:0)
与其在“ press”中传递元素,不传递元素的坐标,而是检查以下代码
传递按下元素的x和y坐标
<Grid item key={item}>
此代码应将元素保留20秒