Window Handles in Ranorex

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
maamer
Posts: 13
Joined: Fri Nov 30, 2018 6:03 pm

Window Handles in Ranorex

Post by maamer » Thu Dec 06, 2018 10:53 pm

hello ,
i am using ranorex to test a print app. i am clicking on the print icon of an image in my app and it opens a new window(which is not my app window) in chrome with the print job. i want to check/validate the printer name displayed in the window and click cancel to go back to the app window. how do i do it? is there any code sample for window handles?

thank you.
Attachments
winhandles.rxsnp
(280.59 KiB) Downloaded 1 time

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

Re: Window Handles in Ranorex

Post by odklizec » Fri Dec 07, 2018 8:52 am

Hi,

At first, Chrome must be started with this parameter:

Code: Select all

--args --force-renderer-accessibility
Otherwise, Ranorex is unable to explore Chrome's form elements.

Then you can use xpath like this, to track printer's name:

Code: Select all

/form[@processname='chrome']/element//element[@accessiblename='Print']/ancestor::element//element[@accessiblerole='None']/element/element/table[@accessiblerole='Table']/row/cell[@visible='true']/text
printer_chrome.png
printer_chrome.png (56.15 KiB) Viewed 45 times
Hope this helps?
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

maamer
Posts: 13
Joined: Fri Nov 30, 2018 6:03 pm

Re: Window Handles in Ranorex

Post by maamer » Fri Dec 07, 2018 3:23 pm

thank you sir,
that worked