Page 1 of 1

Window Handles in Ranorex

Posted: Thu Dec 06, 2018 10:53 pm
by maamer
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.

Re: Window Handles in Ranorex

Posted: Fri Dec 07, 2018 8:52 am
by odklizec
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
Hope this helps?

Re: Window Handles in Ranorex

Posted: Fri Dec 07, 2018 3:23 pm
by maamer
thank you sir,
that worked