using usercode to obtain screen resolution

Mobile Testing, Android App Testing.
Mozzytm
Posts: 36
Joined: Fri Feb 08, 2013 11:18 am

using usercode to obtain screen resolution

Post by Mozzytm » Wed Apr 02, 2014 11:33 am

Hi there,

I'm trying to write swipe left and right functions for use in a mobile test script to do this id like to know the bounds of the screen on whatever device i'm using.

Could anyone advise me on what the code is for this?

Thanks

M

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: using usercode to obtain screen resolution

Post by Support Team » Thu Apr 03, 2014 3:19 pm

Hi,

You can for instance use the following code to get the ScreenRectangle of the main form:
var mainForm = repo.YourElement.YourMailForm;
var rect = mainForm .ScreenRectangle; // you can also get the length and height
Report.Info("bounds: "+rect.ToString());
Regards,
Markus
.
Image

Mozzytm
Posts: 36
Joined: Fri Feb 08, 2013 11:18 am

Re: using usercode to obtain screen resolution

Post by Mozzytm » Fri Apr 04, 2014 10:52 am

Thankyou very much for this.