我尝试使用旧代码按住按钮几秒钟,但是它不再起作用:
TouchAction action = new TouchAction(driver);
WebElement pttB = driver.findElementById("com.br.ptt.brww:id/ptt_button");
Thread.sleep(2000);
action.press(pttB).waitAction(Duration.ofMillis(20000)).release().perform();
它引发错误:
TouchAction类型的press(PointOption)方法不适用于参数(WebElement)