Selenium-Implement page element dragging

Source: Internet
Author: User

Drag and drop, the use of the mouse to implement the drag-and-drop operation seems very complex, in Selenium, with the help of OpenQA.Selenium.Interactions.Actions class Library provides methods, the implementation is relatively simple. The rationale is as follows:

1. Locate the page element you want to drag-source.

2. Find the page element that you want to release-the target, this element of the page may be a pit, but in the page code he is an element.

3. By using (new Actions (Iwebdriver)). Draganddrop (source, target). Perform () to complete the element drag-and-drop operation.

Example code:

// Drag and Drop using OpenQA.Selenium.Interactions;                                 New SIE. Internetexplorerdriver ();                                 if NULL NULL                                 {                                    //  drag and drop                                    new  Actions (driver). Draganddrop (source, target). Perform ();                                }

Selenium-Implement page element dragging

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.