use of org.openqa.selenium.interactions.Actions in project ats-framework by Axway.
the class RealHtmlElement method rightClick.
/**
* Simulate mouse right click action
*/
@Override
@PublicAtsApi
public void rightClick() {
new RealHtmlElementState(this).waitToBecomeExisting();
WebElement element = RealHtmlElementLocator.findElement(this);
new Actions(webDriver).contextClick(element).perform();
}
use of org.openqa.selenium.interactions.Actions 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.Actions in project ats-framework by Axway.
the class RealHtmlElementState method focus.
/**
* Moves the focus to the specified element.
* <b>Note:</b> This is somewhat breakable as
* the browser window needs to be the active system window, otherwise the keyboard
* events will go to another application.
*/
@PublicAtsApi
public void focus() {
// retrieve browser focus
webDriver.switchTo().window(webDriver.getWindowHandle());
// now focus the target element
WebElement webElement = RealHtmlElementLocator.findElement(element);
if ("input".equals(webElement.getTagName())) {
webElement.sendKeys("");
} else {
new Actions(webDriver).moveToElement(webElement).perform();
}
}
use of org.openqa.selenium.interactions.Actions in project ats-framework by Axway.
the class MobileCheckBox method unCheck.
/**
* Uncheck the check box
*/
@Override
@PublicAtsApi
public void unCheck() {
new MobileElementState(this).waitToBecomeExisting();
try {
WebElement checkboxElement = MobileElementFinder.findElement(appiumDriver, this);
if (checkboxElement.isSelected()) {
if (appiumDriver instanceof AndroidDriver) {
// checkboxElement.click(); // throwing exception (on Android) with message: Element is not clickable at point (x,y). Other element would receive the click
new Actions(appiumDriver).moveToElement(checkboxElement).click().perform();
} else {
checkboxElement.click();
}
}
} catch (Exception se) {
throw new MobileOperationException(this, "unCheck", se);
}
UiEngineUtilities.sleep();
}
use of org.openqa.selenium.interactions.Actions in project ats-framework by Axway.
the class HiddenHtmlElement method setTextContent.
/**
* Set the content of the element
* @param content the new content
*/
@PublicAtsApi
public void setTextContent(String content) {
new HiddenHtmlElementState(this).waitToBecomeExisting();
WebElement element = HiddenHtmlElementLocator.findElement(this);
new Actions(htmlUnitDriver).sendKeys(element, content).perform();
}
Aggregations