19 November, 2014

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( );  

No comments:

Post a Comment