I've got the following code which first moves to each element inside of an Ilist and after that should click each element from the Ilist:
Code: Select all
'Creates a list of elements which are clicked one after the other
Dim ElementList As IList (Of Ranorex.ATag) = repo.WebDocumentBDT_BaseLine.Lower_ButtonLine.Self.FindDescendants (Of Ranorex.ATag) ()
Report.Info("Number of objects: " & ElementList.Count.ToString)
For Each Element As Ranorex.ATag In ElementList
'Moves to each element in the list and reports the name of the element
Element.EnsureVisible()
Mouse.MoveTo(Element)
Report.Info(Element.InnerText)
'Clicks on each element and reports the name of the element
Element.EnsureVisible()
Element.PerformClick
Report.Info(Element.InnerText)
Report.Info("Button " & Element.InnerText & " exists")
But after clicking on the first element in the list, the cursor moves to the upper left corner of the GUI and does not click the other elements in the list.
Ranorex Report says:
Time Level Category Message
00:04.817 Info User Jump to itemNumber of objects: 3
00:05.441 Info User Jump to itemLibrary
00:05.738 Info User Jump to itemLibrary
00:05.888 Info User Jump to itemButton Library exists
00:06.184 Warn Automation Jump to itemView HelpCould not get a valid screen rectangle from element '{ATag:}', since the element is no longer valid.
00:06.668 Info User Jump to item(null)
00:06.948 Info User Jump to item(null)
00:07.089 Info User Jump to itemButton exists
00:07.338 Warn Automation Jump to itemView HelpCould not get a valid screen rectangle from element '{ATag:}', since the element is no longer valid.
00:07.806 Info User Jump to item(null)
00:08.087 Info User Jump to item(null)
00:08.212 Info User Jump to itemButton exists
How can I manage, that the elements are clicked on one after the other?
A delay after clicking the first element does not help. Although the elements are visible, ranorex does not manage to click on them.