List of usage examples for org.openqa.selenium.interactions Actions Actions
public Actions(WebDriver driver)
From source file:com.ggasoftware.uitest.control.Element.java
License:Open Source License
/** * Performs a right-click at the current mouse location. * * @return Parent instance//from ww w .j a v a 2s . c o m */ public ParentPanel rightClick() { getWebElement().getSize(); //for scroll to object logAction(this, getParentClassName(), "rightClick"); Actions builder = new Actions(getDriver()); builder.contextClick(getWebElement()).perform(); return parent; }
From source file:com.ggasoftware.uitest.control.Element.java
License:Open Source License
/** * Clicks in the middle of the given element. Equivalent to: * Actions.moveToElement(onElement).click() * * @return Parent instance//from w w w . j a va 2s .c o m */ public ParentPanel clickAction() { getWebElement().getSize(); //for scroll to object logAction(this, getParentClassName(), "clickAction"); alwaysDoneAction(() -> { Actions builder = new Actions(getDriver()); builder.click(getWebElement()).perform(); }); return parent; }
From source file:com.ggasoftware.uitest.control.Element.java
License:Open Source License
/** * Mouse Over on the the given element.//www .j a v a 2s.com * * @return Parent instance */ public ParentPanel mouseOver() { getWebElement().getSize(); //for scroll to object logAction(this, getParentClassName(), "mouseOver"); Actions builder = new Actions(getDriver()); builder.moveToElement(getWebElement()).build().perform(); return parent; }
From source file:com.ggasoftware.uitest.control.Element.java
License:Open Source License
/** * Focus on the Element(WebElement)/*from w ww. j ava2s . co m*/ * * @return Parent instance */ public ParentPanel focus() { Dimension size = getWebElement().getSize(); //for scroll to object logAction(this, getParentClassName(), "focus"); Actions builder = new Actions(getDriver()); org.openqa.selenium.interactions.Action focus = builder .moveToElement(getWebElement(), size.width / 2, size.height / 2).build(); focus.perform(); return parent; }
From source file:com.ggasoftware.uitest.control.Element.java
License:Open Source License
/** * Select some area (mouse from point(x1, y1) to point(x2, y2) in element) * * @param x1 - x1 coordinate of element//from w w w . java 2 s. c o m * @param y1 - y1 coordinate of element * @param x2 - x2 coordinate of element * @param y2 - y2 coordinate of element * @return Parent instance */ public ParentPanel selectArea(int x1, int y1, int x2, int y2) { logAction(this, getParentClassName(), format("Select area: from %d,%d;to %d,%d", x1, y1, x2, y2)); WebElement element = getWebElement(); new Actions(getDriver()).moveToElement(element, x1, y1).clickAndHold().moveToElement(element, x2, y2) .release().build().perform(); return parent; }
From source file:com.ggasoftware.uitest.control.Element.java
License:Open Source License
/** * A convenience method that performs click-and-hold at the location of the source element, moves by a given offset, then releases the mouse. * * @param xOffset - horizontal move offset. * @param yOffset - vertical move offset. * @return Parent instance//from w w w .j a va 2 s . co m */ public ParentPanel dragAndDropBy(int xOffset, int yOffset) { logAction(this, getParentClassName(), format("Drag and drop element: horizontal move offset - %dpx; vertical move offset - %dpx", xOffset, yOffset)); Actions builder = new Actions(getDriver()); Action dragAndDropBy = builder.dragAndDropBy(getWebElement(), xOffset, yOffset).build(); dragAndDropBy.perform(); return parent; }
From source file:com.ggasoftware.uitest.control.Elements.java
License:Open Source License
/** * Focus on the WebElement by index//from www .ja v a 2 s .com * * @param elementIndex - index of WebElement * @return Parent instance */ public ParentPanel focus(int elementIndex) { Dimension size = getWebElements().get(elementIndex).getSize(); //for scroll to object logAction(this, getParentClassName(), "Focus"); Actions builder = new Actions(WebDriverWrapper.getDriver()); org.openqa.selenium.interactions.Action focus = builder .moveToElement(getWebElements().get(elementIndex), size.width / 2, size.height / 2).build(); focus.perform(); return parent; }
From source file:com.ggasoftware.uitest.control.Elements.java
License:Open Source License
/** * Mouse Over on the the element by index. * * @param elementIndex - index of WebElement * @return Parent instance/*from www . j av a 2 s . com*/ */ public ParentPanel mouseOver(int elementIndex) { getWebElements().get(elementIndex).getSize(); //for scroll to object logAction(this, getParentClassName(), "mouseOver"); Actions builder = new Actions(WebDriverWrapper.getDriver()); builder.moveToElement(getWebElements().get(elementIndex)).build().perform(); return parent; }
From source file:com.github.wiselenium.elements.component.impl.ComponentImpl.java
License:Open Source License
@SuppressWarnings("unchecked") @Override//from w w w . j a va2 s . c o m public T doubleClick() { WebDriver driver = WiseContext.getDriver(); Action action = new Actions(driver).doubleClick(this.getWrappedElement()).build(); action.perform(); return (T) this; }
From source file:com.gwtplatform.carstore.cucumber.application.BasePage.java
License:Apache License
private void moveToElement(WebElement webElement) { Actions actions = new Actions(webDriver); actions.moveToElement(webElement); actions.perform(); }