<InCisif.net.Library.Test("", 1, TestPriority.High)> _ Public Sub DragAndDropDemo3Test() Dim t As New InCisif.net.Library.Test(Language.VBNET, Me) Try Page.URL = "http://www.dhtmlgoodies.com/scripts/drag-drop-custom/demo-drag-drop-3.html" Page.WaitForPage("/demo-drag-drop-3.html") Page.Options.SlowMode = 100 Page.TRACE(String.Format("Visible:{0}", Page.Control("DHTMLgoodies_dragableElement5").Visible)) Page.Options.MouseMove = False DragAndDropMoveBox(1) t.ASSERT(IsInTheRightCountry(1), "Verify the color of the box") DragAndDropMoveBox(2) t.ASSERT(IsInTheRightCountry(2), "Verify the color of the box") DragAndDropMoveBox(3) t.ASSERT(IsInTheRightCountry(3), "Verify the color of the box") DragAndDropMoveBox(4) t.ASSERT(IsInTheRightCountry(4), "Verify the color of the box") DragAndDropMoveBox(5) t.ASSERT(IsInTheRightCountry(5), "Verify the color of the box") DragAndDropMoveBox(6) t.ASSERT(IsInTheRightCountry(6), "Verify the color of the box") DragAndDropMoveBox(7) t.ASSERT(IsInTheRightCountry(7), "Verify the color of the box") t.Passed = True Finally t.Dispose() End Try End Sub ' ' Return True if the box has a green background color ' Private Function IsInTheRightCountry(ByVal boxIndex As Integer) As Boolean Try Return Page.Control("box" & boxIndex).Style.backgroundColor.ToString() = "#0f0" Catch ex As Exception End Try Return False End Function ' ' Drag and Drop a city-box into the right country-box ' To find what is the right country-box we use the city-box prefixed with the ' value 10 ' Private Function DragAndDropMoveBox(ByVal boxIndex As Integer) As Boolean Page.ToolBox.Stack.Push(Page.Options.MouseMove) Page.Options.MouseMove = False Page.Control("box" & boxIndex).MouseMove() ' We have to apply the mouse down on 2 controls Page.Control("box" & boxIndex).MouseDown() Page.Control("DHTMLgoodies_dragableElement" & (boxIndex - 1)).MouseDown() ' Move the mouse to the html control to drop Page.Control("box10" & boxIndex).MouseMove() ' Move the cursor to the right destination - Cheating ' We have to apply the mouse up on 2 controls Page.Control("box" & boxIndex).MouseUp() Page.Control("DHTMLgoodies_dragableElement" & (boxIndex - 1)).MouseUp() Dim WaitTimerMode As Integer = 1 Page.Wait(1, WaitTimerMode) Page.Options.MouseMove = Page.ToolBox.Stack.Pop(False) Return True End Function