The release on another WebElement action

This is an overloaded version of the release() method. Using this, you can actually release the currently held WebElement in the middle of another WebElement. In this way, we don't have to calculate the offset of the target WebElement from the held WebElement.

The API syntax is as follows:

public Actions release(WebElement onElement)

The input parameter for the preceding method is obviously the target WebElement, where the held WebElement should be dropped. The return type is the instance of the Actions class.

Let's modify the preceding code example to use this method:

@Testpublic void shouldClickAndHoldAndReleaseOnElement() {    driver.get("http://guidebook.seleniumacademy.com/Sortable.html");    WebElement ...

Get Selenium WebDriver 3 Practical Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.