Get size(pixel) of element found by spy in code

Ask general questions here.
chanow
Posts: 5
Joined: Tue Jan 15, 2013 11:00 am

Get size(pixel) of element found by spy in code

Post by chanow » Fri Mar 08, 2013 9:47 am

Dear all,

In ranorex spy I can get size of a found element
for example
Image

I need those values for some use
Is it possible to use those values in user code?
If it 's possible, can someone kindly tell me how to get those values in user code?

Thank you very much

hs.fk
Posts: 12
Joined: Thu Jul 12, 2012 11:47 am
Location: Hamburg

Re: Get size(pixel) of element found by spy in code

Post by hs.fk » Fri Mar 08, 2013 10:49 am

Ranorex.Button btnStart = "/button[@text='Start']";
Report.Info( string.Format(
  "Win-Startbutton width: '{0}' height: '{1}'",
  btnStart.ScreenRectangle.Size.Width,
  btnStart.ScreenRectangle.Size.Height ) );
Output:

Code: Select all

Win-Startbutton width: '54' height: '40'