01/04/2017
#8.8.1 Actions Class: Generic APIs cont...
16. moveByOffset(int xOffSet, int yOffSet)– this API is used to move the cursor from its current location (or from 0,0) by the given offset. For xOffset, -ve value means to move LEFT and for yOffset, -ve value means to move UP.
Method Signature: public Actions moveByOffset(int xOffset, int yOffset) {…}
Method Call: actions.moveByOffset(20,20).perform();
Exception thrown: MoveTargetOutOfBoundException – if the offset provided is out of the document’s boundary
17. moveToElement(WebElement webElement)– this API is used to move the cursor to the middle of the referenced WebElement from its current location.
Method Signature: public Actions moveToElement(WebElement webElement) {…}
Method Call: actions.moveToElement(webElement).perform();
18. moveToElement(WebElement webElement, int xOffSet, int yOffSet)– this API is used to move the cursor to the given offset from the top-left corner of the referenced WebElement.
Method Signature: public Action moveToWebElement(WebElement webElement, int xOffset, int yOffset) {…}
Method Call:actions.moveToElement(webElement, 10, 10) .perform();
19. pause(long milliseconds)– this API is used to make a pause to the ex*****on flow for the given amount of milliseconds (passed as a parameter to this API) irrespective of the situation and scenario. It is DEPRECATED now and so is not recommended to use.
Method Signature: public Actions pause(long milliseconds) {…}
Method Call: actions.pause(5000).perform();
20. perform()– This is used when we want to perform a single action but not multiple (for multiple-sequential action we need to make use of …build().perform();). When we call perform() API , build() API gets called internally before executing perform().
Method Signature: public Actions perform() {…}
Method Call: actions..perform();