Each window is being recognized by Ranorex as a form with a close button.
The Xpath is similar to this:
/form[@title='Table\ <dynamic name>\ \blahblah']/titlebar/button[@accessiblename='Close']
So the first window opened might be
/form[@title='Table\ vanilla-32\ \blahblah']/titlebar/button[@accessiblename='Close']
The next could be
/form[@title='Table\ chocolate-5\ \blahblah']/titlebar/button[@accessiblename='Close']
and so on.
These names are coming from a list that is variable, so while the first window opened in test run 1 may be vanilla-32, in test run 2 it could be strawberry-86.
I have this in the Repository:
MyDynamicWindow with Xpath /form[@title~'^Table\ .*\ \blahblah']
ButtonClose with Xpath Base:/titlebar/button[@accessiblename='Close']
I have this in code:
Code: Select all
Dim dynamicWindow As Ranorex.Form = "/form[@title~'^Table\ .*\ \blahblah']"
Dim dynamicWindowCloseButton As Ranorex.Button = "/form[@title~'^Table\ .*\ \blahblah']/titlebar/button[@accessiblename='Close']"
<open window 1 - name pistachio-5>
Validate.Exists(dynamicWindow)
<open window 2 - name coffee-34>
Validate.Exists(dynamicWindow)
Element '{Form: pistachio-5}' does exist.
Element '{Form: coffee-34}' does exist.
I get this output:
Element '{Form: pistachio-5}' does exist.
Element '{Form: pistachio-5}' does exist.
It's not recognizing the second window as unique, even though it also matches the dynamicWindow path.
Likewise, if I open 10 windows, and then try to gather all their close buttons using
Code: Select all
Dim closeButtonList As IList(Of Ranorex.Button) = repo.MyDynamicWindow.ButtonCloseInfo.CreateAdapters(Of Ranorex.Button)()
How do I deal with this? I can't close each window after I open it because all the windows have to be open at the same time.
Thanks,
Lisa