Retrieve and validate a window's rectangle

Best practices, code snippets for common functionality, examples, and guidelines.
HansSchl
Posts: 125
Joined: Wed Sep 19, 2018 10:05 am

Retrieve and validate a window's rectangle

Post by HansSchl » Thu Jan 27, 2022 4:41 pm

Hi,

a test should verify that a window, after being minimized and restored, occupies the same screen rectangle as before. I tried to retrieve any of the related properties which I can se in Ranorex Spy - Location, ScreenLocation, ScreenRectangle, Size - but all I get is 'null'. Am I missing something, or do I have to write code?

(I don't mind writing code, but I'd like to have a student create the test for me.)

Cheers
Hans

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

Re: Retrieve and validate a window's rectangle

Post by odklizec » Fri Jan 28, 2022 9:55 am

Hi,

As far as I know, Screen/ClientRectangle values are only obtainable via code...
repo.item.self.Element.ScreenRectangle.Width
repo.item.self.Element.ScreenRectangle.x
repo.item.self.Element.ScreenRectangle.y
repo.item.self.Element.ClientRectangle.Width
repo.item.self.Element.ClientRectangle.x
repo.item.self.Element.ClientRectangle.y
etc...
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