exist, notExist, countIs

in Japanese(日本語)

Checks whether elements matched by a selector exist, are gone, or number a given count.

Functions

function description
exist(selector, requireVisible:, waitSeconds:, scroll:, maxSwipes:) Asserts existence and returns the matched element, so text/value/id checks can chain onto it. On a run with fmTextVisibilityCheck or ocrTextVisibilityCheck set to true in the run profile, also confirms the element is actually visible.
notExist(selector, waitSeconds:, scroll:, maxSwipes:) Waits until the element is gone (already absent succeeds immediately). With scroll:, scrolls in that direction while searching, and finding the element fails the check; without a match while scrolling, falls back to waiting for disappearance on the current viewport.
countIs(selector, count, waitSeconds:) Asserts the number of matching candidates in the tree. Visibility is not considered. || counts the union (duplicates counted once). When counting by label, narrow by type first, e.g. .button&&Add — a button and its inner label are separate elements and both would match a bare label.
exist(selector, scroll: .noScroll) Checks existence on the current screen even inside a withScrollDown / withScrollUp / withScrollRight / withScrollLeft block.

waitForDisplay / waitForClose wait for an element to appear or disappear without scrolling — see wait.

Example

expectation {
    exist("#welcome_text||Welcome")
    notExist("#loading_spinner")
    countIs("#cart_item", 3)
}

Notes