Actions act= new Actions(driver) įor drag and drop element we use dragAndDrop method of Actions class and passes the parameters as the first element(Sourcelocator) “From” and the second element(Destinationlocator) “To”.
WebElement we create object of Actions class as we use methods of Actions class. Explained briefly below:įirst, we capture the 1 st element which we need to drag in variable “From.” WebElement we capture the 2nd element on which we need to drop the 1st element in variable “To”.
#The 100 click and drag code
WebElement Action class for drag and drop.Īct.dragAndDrop(From, To).build().perform() Ĭode Explanation: In the above code we launch the given URL in Firefox browser and then drag the BANK element and drop on the DEBIT SIDE block through dragAndDrop method. tProperty(""," E://Selenium//Selenium_Jars//chromedriver.exe ") In the following code, we launch the given URL in Firefox browser and then drag the BANK element and drop on the DEBIT SIDE block through dragAndDrop method. Scenario 1: BANK element is dragged and dropped on the specific cell by DragAndDrop method.
#The 100 click and drag how to