ifCanSelect, ios, android

in Japanese(日本語)

Conditional execution: run a block only when a selector resolves, or only on one OS.

Functions

function description
ifCanSelect(sel, waitSeconds: 0) { }.ifElse { } Runs the block when the selector resolves. Decides immediately, once, unless waitSeconds: is given. .ifElse { } is optional and runs when it does not resolve.
ios { } Runs the block only when the current platform is iOS.
android { } Runs the block only when the current platform is Android.

Example

tap("#request_location")
ifCanSelect("Allow While Using App", waitSeconds: 3) {
    tap("Allow While Using App")     // does nothing if it never appeared (already granted)
}.ifElse {
    // optional: runs when the selector did not resolve
}

expectation {
    ios { notExist("#ios_only_banner") }
    android { notExist("#android_only_banner") }
}

Notes