Skip to content

Ui helper

MilleBo edited this page Mar 3, 2017 · 1 revision

Here I will document UI helper methods and examples

Waiting for any ui object

Scenario

You're clicking on a login button and multiple things can happen:

  • You're already logged in and are transfered to a main page
  • You're not logged in an have to provide login information

We first create two gui object:

var main = device.Ui.CreateUiObject(With.ResourceId("mainPage"));
var login = device.Ui.CreateUiObject(With.ResourceId("login"));

We then wait for any of them:

var foundObject = UiWait.ForAny(10, main.IsVisible, login.IsVisible);

And finally check which one of them that we found:

if(foundObject == main)
{
  //Do x
}
else
{
  //Do y 
}
Clone this wiki locally