My Blog List

Monday, November 14, 2011

Selenium - Drag and Drop Operation


The inbuilt dragAndDrop function provided by selenium RC classes will do the expected operation well easily. Some times its difficult to do drag and drop operations like drop on particular element, etc. Here is the approach.


1. Drag an element to drop on to another element:
  1. driver.get("myURL");
  2. var from = driver.findElement(By.xpath("fromElement"));
  3. var to = driver.findElement(By.xpath("toElement"));
  4. new Actions(driver).dragAndDrop(from, to).build().perform();

2. Drag an element to an offset:
  1. driver.get("myURL");
  2. var dragElement = browser.findElement(By.id("ElementToDrag"));
  3. new Actions(driver).dragAndDropBy(dragElement , 20010).build().perform();


16 comments:

  1. I actually enjoyed reading through this posting.Many thanks.


    Selenium Training in Chennai

    ReplyDelete
  2. Hey, nice site you have here! Keep up the excellent work!
    Selenium Training in Chennai

    ReplyDelete
  3. Hey, nice site you have here! Selenium Training in Chennai Keep up the excellent work!

    ReplyDelete
  4. Your comment is very good share it.
    http://www.way2automation.com/selenium_tutorial/selenium-training-institute-rc-webdriver-delhi-ncr.html

    ReplyDelete
  5. Java is one of the popular technologies with improved job opportunity for hopeful professionals. Java Course in Chennai helps you to study this technology in details.If you are looking for best Java Training Institutes in Chennai reach Fita academy.

    ReplyDelete
  6. The information you posted here is useful to make my career better. Thanks for sharing such a informative post. keep updates...

    Regards..
    Salesforce Training in Chennai

    ReplyDelete
  7. Thanks for sharing this information. Salesforce is a cloud based CRM. Nowadays most of the multinational companies used this CRM for managing their customers. To know more details call 9841746595.

    Regards..
    Salesforce Training

    ReplyDelete
  8. Thanks for sharing this information. SEO is one of the digital marketing techniques which is used to increase website traffic and organic search results. If anyone wants to get SEO Course Chennai visit FITA Academy located at Chennai.

    ReplyDelete
  9. Really awesome blog. Software testing is a method of executing the application or program with the intent of searching the software errors. Software Testing Course in Chennai offering this course at reasonable cost.

    ReplyDelete
  10. Excellent information. HTML5 is a markup language used for designing responsive website and it is also used for structuring and presenting the website content.

    Regards.
    HTML5 Training | PHP Course in Chennai

    ReplyDelete
  11. I get a lot of great information from this blog. Thank you for your sharing this informative blog. Just now I have completed hadoop certification course at a leading academy. If you are interested to learn Hadoop Course in Chennai visit FITA IT training and placement academy.

    ReplyDelete
  12. Hi, Your blog is really very informative and useful for me. Thanks for sharing this valuable blog.
    Regards..
    Unix Training Institutes in Chennai

    ReplyDelete
  13. Thanks for sharing great information in your blog. Got to learn new things from your Blog . It was very nice blog to learn about Selenium

    ReplyDelete
  14. Great efforts put it to find the list of articles useful for Selenium, Definitely will share the same to other forums.
    We are also one of the best sources to learn Selnium -Selenium training in Chennai |Best Selenium training institute in Chennai

    ReplyDelete