How to perform Drag and Drop operation in Selenium Webdriver?

Step1: Store the path of Source and Target in the  Web-Elements.

       WebElement Source = driver.findElement(by.---( ));  
WebElement Target = driver.findElement(by.---( ));

Step2: Using the Action class  create an object of it.

  Actions builder = new Actions(driver);  

Step3: Perform Drag and Drop operation

      Action drag = builder.clickAndHold(Source).moveToElement(Target).release(Target).build( );  
drag.perform( );


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s