use of org.openqa.selenium.interactions.Action in project java.webdriver by sayems.
the class ActionBuildPerform method main.
public static void main(String... args) {
WebDriver driver = new FirefoxDriver();
driver.get("file://C:/selectable.html");
WebElement one = driver.findElement(By.name("one"));
WebElement three = driver.findElement(By.name("three"));
WebElement five = driver.findElement(By.name("five"));
// Add all the actions into the Actions builder.
Actions builder = new Actions(driver);
builder.keyDown(Keys.CONTROL).click(one).click(three).click(five).keyUp(Keys.CONTROL);
// Generate the composite action.
Action compositeAction = builder.build();
// Perform the composite action.
compositeAction.perform();
}
use of org.openqa.selenium.interactions.Action in project ats-framework by Axway.
the class RealHtmlElement method dragAndDropTo.
/**
* Drag and drop an element on top of other element
* @param targetElement the target element
*/
@Override
@PublicAtsApi
public void dragAndDropTo(HtmlElement targetElement) {
new RealHtmlElementState(this).waitToBecomeExisting();
WebElement source = RealHtmlElementLocator.findElement(this);
WebElement target = RealHtmlElementLocator.findElement(targetElement);
Actions actionBuilder = new Actions(webDriver);
Action dragAndDropAction = actionBuilder.clickAndHold(source).moveToElement(target, 1, 1).release(target).build();
dragAndDropAction.perform();
// drops the source element in the middle of the target, which in some cases is not doing drop on the right place
// new Actions( webDriver ).dragAndDrop( source, target ).perform();
}
use of org.openqa.selenium.interactions.Action in project ats-framework by Axway.
the class HiddenHtmlElement method dragAndDropTo.
/**
* Drag and drop an element on top of other element
* @param targetElement the target element
*/
@Override
@PublicAtsApi
public void dragAndDropTo(HtmlElement targetElement) {
new HiddenHtmlElementState(this).waitToBecomeExisting();
WebElement source = HiddenHtmlElementLocator.findElement(this);
WebElement target = HiddenHtmlElementLocator.findElement(targetElement);
Actions actionBuilder = new Actions(htmlUnitDriver);
Action dragAndDropAction = actionBuilder.clickAndHold(source).moveToElement(target, 1, 1).release(target).build();
dragAndDropAction.perform();
// drops the source element in the middle of the target, which in some cases is not doing drop on the right place
// new Actions( htmlUnitDriver ).dragAndDrop( source, target ).perform();
}
Aggregations