try {
Actions actions = new Actions(driver);
actions.moveToElement(element, 10, 5).clickAndHold()
.moveByOffset(30, 0).release().perform();
Thread.sleep(2000);
driver.findElement(By.id("annotation_save_button")).click();
Thread.sleep(2000);
driver.findElement(By.id("transcript_more_options_icon")).click();
} catch (Exception e) {
e.printStackTrace();
}
我可以在Firefox中选择文字,但在Chrome中却不是这样。在任一浏览器中运行这段代码时,我都没有异常。