本文介绍了如何自动化拖拽删除功能使用Selenium WebDriver Java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何自动化拖拽在Java中使用 Selenium WebDriver
删除功能
How to automate drag & drop functionality using Selenium WebDriver
in java?
推荐答案
有一个页面记录高级用户交互;它有很多很好的例子,如何生成一系列的动作,
There is a page documenting Advanced User Interactions; which has a lot of great examples on how to generate a sequence of actions, 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();
这篇关于如何自动化拖拽删除功能使用Selenium WebDriver Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!