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, but the user can only drag one card at a time in the column.
Qns1 > I would like to create a test script that will drag the card to a certain column, can it be done without using coordinates?
Qns 2 > Also, if there are multiple cards in one column, how can I find the card that I want to drag by the content text name?
I was thinking of adding the card name into a variable when the card is created and added to the 1st column, and then call that variable to find the card in the column to drag the card to the next column (i.e. 2nd column), can it be done?
Can you provide a sample in JavaScript, I am not proficient in programming but good at learning by samples?
Attached is the script (Card) that is created by TestComplete when I drag the card from column 1 to column 2.
I used the Spy to capture the properties for each column (1st, 2nd and 3rd).
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.
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.