0

In QTP, we can use below code:

if obj1.exist(5)
   obj1.click;
else
   obj2.click

We can control the wait time and if one UI exists, we can do some operation.

how to work out the same situation in Monkey Talk with JS?

and can I get the orientation of the IOS device with JS?

Milen
  • 8,697
  • 7
  • 43
  • 57

1 Answers1

2

Use the following to see if a component exists, Label * Verify %timeout=10000. This will wait 10 seconds to find a label. You can use JavaScript like the following...

try {
    app.label().verify(); //if label exists
} catch(Exception err) {
    app.debug().print("Label not found");
}

To get the orientation you can do the following, Device * var orientation