|
|
@ -223,22 +223,46 @@ public class BrowserCommon { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* mouse drag element |
|
|
|
* mouse drag element |
|
|
|
* |
|
|
|
* |
|
|
|
* @param source_locator BY |
|
|
|
* @param sourceLocator BY |
|
|
|
* @param target_locator BY |
|
|
|
* @param targetLocator BY |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void dragAndDrop(By source_locator, By target_locator) { |
|
|
|
public void dragAndDrop(By sourceLocator, By targetLocator) { |
|
|
|
WebElement sourceElement = locateElement(source_locator); |
|
|
|
WebElement sourceElement = locateElement(sourceLocator); |
|
|
|
WebElement targetElement = locateElement(target_locator); |
|
|
|
WebElement targetElement = locateElement(targetLocator); |
|
|
|
actions.dragAndDrop(sourceElement, targetElement).perform(); |
|
|
|
actions.dragAndDrop(sourceElement, targetElement).perform(); |
|
|
|
actions.release(); |
|
|
|
actions.release(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void moveToDragElement(By target_locator, int X, int Y) { |
|
|
|
public void moveToDragElement(By targetLocator, int x, int y) { |
|
|
|
WebElement targetElement = locateElement(target_locator); |
|
|
|
WebElement targetElement = locateElement(targetLocator); |
|
|
|
actions.dragAndDropBy(targetElement, X, Y).perform(); |
|
|
|
actions.dragAndDropBy(targetElement, x, y).perform(); |
|
|
|
actions.release(); |
|
|
|
actions.release(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Right mouse click on the element |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param locator By |
|
|
|
|
|
|
|
* @return actions |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void mouseRightClickElement(By locator) { |
|
|
|
|
|
|
|
WebElement mouseRightClickElement = locateElement(locator); |
|
|
|
|
|
|
|
actions.contextClick(mouseRightClickElement).perform(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* The mouse moves from a position to a specified positionØ |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param sourceLocator BY |
|
|
|
|
|
|
|
* @param targetLocator BY |
|
|
|
|
|
|
|
* @return actions |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void mouseMovePosition(By sourceLocator, By targetLocator) throws InterruptedException { |
|
|
|
|
|
|
|
WebElement sourceElement = locateElement(sourceLocator); |
|
|
|
|
|
|
|
WebElement targetElement = locateElement(targetLocator); |
|
|
|
|
|
|
|
actions.dragAndDrop(sourceElement,targetElement).perform(); |
|
|
|
|
|
|
|
actions.click(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* jump page |
|
|
|
* jump page |
|
|
|