How to capture three similar windows in a List

Ask general questions here.
avi6666
Posts: 21
Joined: Tue Apr 17, 2018 12:40 pm

How to capture three similar windows in a List

Post by avi6666 » Mon Nov 04, 2019 10:43 am

In a particular scenario

i have three windows with same xpath. 3 similar windows (some contents will be different)

i need to transverse through them and close two of them based on some condition of the contents available in them.

i tried these below code ... nothing returns to the Ilist



IList<Ranorex.Adapter> repoitems= repo.wndAppointmentBook.Self.Find<Ranorex.Adapter>("/form[@controlname='MDIParent_Renamed']");

foreach(Ranorex.Adapter item in repoitems)
{
item.Focus();
if(!(item.Element.GetAttributeValueText("Text").Contains(ApptBookName)))

{
gl.ClickMenuItem(repo.wndAppointmentBook.mainMenuAppointmentBook, "Appointment;Exit");
Delay.Milliseconds(2000);
Report.Success("Closing All other Default Appointment Books");
}




can anyone please help me out

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6037
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to capture three similar windows in a List

Post by odklizec » Mon Nov 04, 2019 10:59 am

Hi,

Please post a Ranorex snapshot (NOT screenshot) of the UI you are working with.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

avi6666
Posts: 21
Joined: Tue Apr 17, 2018 12:40 pm

Re: How to capture three similar windows in a List

Post by avi6666 » Mon Nov 04, 2019 12:22 pm

PFA
Attachments
ABForm.rxsnp
(103.01 KiB) Downloaded 6 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6037
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to capture three similar windows in a List

Post by odklizec » Mon Nov 04, 2019 12:29 pm

Hi,

Thanks. Please post also the xpath behind repo.wndAppointmentBook element. Ideally, post the snapshot of entire repo.wndAppointmentBook app and not just single form .

The snapshot you posted shows just single form[@controlname='MDIParent_Renamed']. If you search for this from starting from repo.wndAppointmentBook, then the Find method may most probably not find anything. So instead of this:

Code: Select all

 repo.wndAppointmentBook.Self.Find<Ranorex.Adapter>("/form[@controlname='MDIParent_Renamed']");
You should try this:

Code: Select all

Host.Local.Find<Ranorex.Adapter>("/form[@controlname='MDIParent_Renamed']");
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration