Forum Discussion

nedbacan's avatar
nedbacan
Frequent Contributor
2 years ago
Solved

Drag a card through different columns by name

Hello .  Can someone help?   I have a web application that contains 3 columns, in each column the user can drag the card horizontally to any of the 3 columns.  Each column can hold as many cards, ...
  • KB1's avatar
    2 years ago
    1. Yes, it is possible to drag a card to a certain column without using coordinates. You can use the TestComplete DOM methods to find the card element and then use the "Drag" method to drag it to the desired column.

    2. To find the card that you want to drag by its content text name, you can use the TestComplete DOM methods to find the card element based on its text content. You can use the "FindChild" or "FindChildren" method to search for the element with the desired text content and then use the "Drag" method to drag it to the desired column.

    Here is a sample JavaScript code that demonstrates how to drag a card from the first column to the second column based on its text content:

    // Find the first column element
     var column1 = Sys.Browser("").Page("").FindChild("id", "column1", 10);
    
    // Find the card element in the first column with the desired text content
     var cardToMove = column1.FindChild("textContent", "Card 1", 10);
    
    // Find the second column element
    var column2 = Sys.Browser("").Page("").FindChild("id", "column2", 10);
    
    // Drag the card to the second column
     cardToMove.Drag(column2);

    I hope this helps! Let me know if you have any questions.