Skip to contents

pz_find_last() is pz_find() with which = "last". With a target, it pins the spec's last match. Without a target, it narrows the current scope to its last element: one eager slice of the pinned set, with no re-query and no waiting.

Usage

pz_find_last(ctx, target = NULL, ..., from_root = FALSE)

Arguments

ctx

A paparazzi context.

target

A CSS selector string or a pz_loc() spec. NULL narrows the current scope; a union can't pick one match by position, and a spec that already carries which is an error.

...

Checked empty; reserved for future use.

from_root

Resolve the target from the page root instead of the current scope? Requires a target.

Value

A new context.

Examples

page <- pz_open(pz_example("tasks"))
page |>
  pz_find_last(".task") |>
  pz_get_text(target = ".task-title")
#> [1] "Call the bank"
pz_close(page)