如何在 java 中使用 Selenium WebDriver
自动化拖放功能?
最佳答案
有一个页面记录了高级用户交互;其中有很多关于如何生成一系列 Action 的很好的例子,you can find it here
// Configure the action
Actions builder = new Actions(driver);
builder.keyDown(Keys.CONTROL)
.click(someElement)
.click(someOtherElement)
.keyUp(Keys.CONTROL);
// Then get the action:
Action selectMultiple = builder.build();
// And execute it:
selectMultiple.perform();
或
Actions builder = new Actions(driver);
Action dragAndDrop = builder.clickAndHold(someElement)
.moveToElement(otherElement)
.release(otherElement)
.build();
dragAndDrop.perform();
关于java - 如何使用 Selenium WebDriver Java 自动化拖放功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14210051/