Polls expr until it evaluates truthy, then returns ctx invisibly.
Each poll awaits a promise expr returns, so async conditions work;
JavaScript truthiness applies (a non-empty string or a non-zero
number counts). An expr that throws is a JavaScript error, not a
failed poll.
Details
There is deliberately no element-state wait (pz_wait_for(target, state =)): pz_expect_visible(), pz_expect_hidden(), and
pz_expect_exists() with not = TRUE already retry, so they wait.
Examples
page <- pz_open(pz_example("tasks"))
page |>
pz_act_type("Buy milk", target = "#task-title") |>
pz_act_press("Enter") |>
pz_wait_for_js("document.querySelectorAll('.task').length === 8")
pz_get_text(page, target = pz_loc(".task-title", which = "first"))
#> [1] "Buy milk"
pz_close(page)
