playwright.controller.Offcanvas
playwright.controller.Offcanvas(page, id)Controller for shiny.express.ui.offcanvas.
Attributes
| Name | Description |
|---|---|
| expect | Expectation method equivalent to playwright.expect(self.loc). |
| id | The browser DOM id of the UI element. |
| loc | Playwright Locator for the offcanvas root element (bslib-offcanvas#{id}). |
| loc_body | Playwright Locator for the offcanvas body. |
| loc_close | Playwright Locator for the close button inside the offcanvas header. |
| page | Playwright Page of the Shiny app. |
Methods
| Name | Description |
|---|---|
| close | Closes the offcanvas panel. |
| expect_body | Expects the offcanvas body to have the specified text. |
| expect_open | Expects the offcanvas panel to be open or closed. |
| set | Sets the offcanvas panel to open or closed. |
close
playwright.controller.Offcanvas.close(timeout=None)Closes the offcanvas panel.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| timeout | Timeout |
The maximum time to wait for the offcanvas to close. Defaults to None. |
None |
expect_body
playwright.controller.Offcanvas.expect_body(value, *, timeout=None)Expects the offcanvas body to have the specified text.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| value | PatternOrStr |
The expected text pattern or string. | required |
| timeout | Timeout |
The maximum time to wait for the offcanvas body to appear. Defaults to None. |
None |
expect_open
playwright.controller.Offcanvas.expect_open(value, *, timeout=None)Expects the offcanvas panel to be open or closed.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| value | bool | True if the offcanvas should be open, False if it should be closed. |
required |
| timeout | Timeout |
The maximum time to wait for the expectation to pass. Defaults to None. |
None |
set
playwright.controller.Offcanvas.set(open, *, timeout=None)Sets the offcanvas panel to open or closed.
Opening an offcanvas panel requires an external trigger element in the app (e.g. an action button wired to toggle_offcanvas()). Only closing (open=False) is supported programmatically by this controller.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| open | bool | False to close the offcanvas. True is accepted but has no effect since the panel can only be opened via an app-level trigger. |
required |
| timeout | Timeout |
The maximum time to wait for the offcanvas to change state. Defaults to None. |
None |