Skip to contents

Pages, apps and navigation

Open a page, a Shiny app, a Quarto document or a static site to start a chain. Set the page’s size and display settings, and move between pages.

pz_open()
Open a page
pz_close()
Close a page
pz_example()
Paths to example pages and apps
pz_with_page() pz_local_page()
Open a page that closes when a block or calling frame exits
pz_serve_shiny()
Run a Shiny app in a background process
pz_serve_quarto()
Serve a document or project with Quarto
pz_serve_static()
Serve static files over HTTP
pz_device()
Set the page's size and display settings
pz_nav_goto() pz_nav_reload() pz_nav_back() pz_nav_forward()
Navigate the page

Screenshots and recording

Capture the page as a PNG screenshot or record it as an MP4, WebM or GIF video. pz_stage() sets how actions look while recording: the cursor, the typing speed and the pause after each step.

pz_record()
Record a block of code
pz_screenshot()
Take a screenshot
pz_stage()
Stage animation settings
pz_record_start()
Record a page interaction
pz_record_stop()
Stop a recording and write the video
pz_record_pause() pz_record_resume()
Pause and resume a recording
pz_record_hold()
Hold the current frame while recording

Actions

Use the page the way a person would: click, type, press keys, scroll and drag. While recording, actions are staged. The pz_set_*() functions set values directly instead.

paparazzi-actions
How actions work
pz_act_click()
Click an element
pz_act_type()
Type text into an element
pz_act_press()
Press key combinations
pz_act_hover()
Hover the pointer over an element
pz_act_scroll()
Scroll the page or an element into view
pz_act_drag()
Drag an element to another element or by an offset
pz_act_select_text()
Select text inside an element
pz_act_focus()
Focus an element
pz_act_blur()
Blur the focused element
pz_set_value()
Set the value of a form control
pz_set_shiny_input()
Set a bound Shiny input
pz_set_files()
Attach files to a file input

Annotations

Mark elements, point at them with callouts, spotlight or redact them, and add captions. Annotations appear in screenshots and recordings. pz_stage_annotate() sets their default styles.

pz_annotate()
Mark page elements
pz_annotate_callout()
Add text callouts to page elements
pz_annotate_spotlight()
Spotlight page elements
pz_annotate_redact()
Redact page elements
pz_annotate_caption()
Add a screen-space caption
pz_annotate_clear()
Clear page annotations
pz_stage_annotate()
Stage annotation style defaults

Fonts

Stage fonts from Google Fonts, Bunny Fonts or local files so that annotations, callouts, captions and key callouts render in them.

pz_stage_fonts()
Stage fonts for annotations and captions
pz_font_google()
Declare a font from Google Fonts
pz_font_bunny()
Declare a font from Bunny Fonts
pz_font_file()
Declare a font from a local file

Framing and camera

Choose the part of the page that a screenshot or recording shows with pz_frame(), and set a default for the chain with pz_stage_frame(). During a recording, the camera zooms in on part of the frame and back out without changing the live page.

pz_frame()
Frame a capture region
pz_stage_frame()
Stage the default framing
pz_camera()
Move the recording camera
pz_camera_reset()
Reset the recording camera

Cursor

Show, move and hide the cursor drawn over the page. Its speed and size are set with pz_stage().

pz_cursor_show()
Show the overlay cursor
pz_cursor_move()
Move the overlay cursor to an element
pz_cursor_leave()
Move the overlay cursor out of the frame
pz_cursor_hide()
Hide the overlay cursor

Finding elements

Describe elements with reusable specs, and narrow a chain to part of the page with scopes.

pz_loc()
Locate elements by CSS, with text, position, and scope qualifiers
pz_find()
Find elements and push them as the current scope
pz_find_first()
Find the first match and push it as the current scope
pz_find_last()
Find the last match and push it as the current scope
pz_find_nth()
Find the nth match and push it as the current scope
pz_find_pop()
Pop the current scope
pz_find_reset()
Clear all scope, back to the root

Expectations

Check the page, retrying until the check passes or times out. Inside testthat, expectations count as test expectations.

pz_expect_attr()
Expect attributes
pz_expect_checked()
Expect elements to be checked
pz_expect_class()
Expect a class
pz_expect_count()
Expect a number of matching elements
pz_expect_enabled()
Expect elements to be enabled
pz_expect_exists()
Expect at least one element to match
pz_expect_focused()
Expect elements to be focused
pz_expect_in_viewport()
Expect elements to be in the viewport
pz_expect_js()
Expect a JavaScript predicate to hold
pz_expect_style()
Expect computed styles
pz_expect_text()
Expect element text content
pz_expect_title()
Expect the page title
pz_expect_url()
Expect the page URL
pz_expect_value()
Expect element values
pz_expect_visible() pz_expect_hidden()
Expect elements to be visible

Waits

Wait for the page to settle when there’s no specific value to expect.

pz_wait()
Wait while pumping the page's event loop
pz_wait_for_js()
Wait until a JavaScript condition holds
pz_wait_for_navigation()
Wait for a navigation to finish
pz_wait_for_shiny_idle()
Wait until a Shiny page is idle
pz_wait_for_stable()
Wait until an element stops changing

Getters

Read values from the page. Getters return values, so they end the chain.

pz_get_attr()
Read an attribute of matching elements
pz_get_count()
Count matching elements
pz_get_elements()
Describe matching elements
pz_get_html()
Read the HTML of matching elements
pz_get_rect()
Read the geometry of matching elements
pz_get_style()
Read computed styles of matching elements
pz_get_text()
Read the text of matching elements
pz_get_title()
Read the page title
pz_get_url()
Read the page URL
pz_get_value()
Read the value of matching elements

Escape hatches and debugging

pz_inspect()
Inspect the current page state
pz_js()
Evaluate JavaScript in the page
pz_chromote()
Get the underlying ChromoteSession