playwright.controller.Chat

playwright.controller.Chat(self, page, id)

Controller for shiny.express.ui.chat.

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 chat.
loc_input Playwright Locator for the chat’s
loc_input_button Playwright Locator for the chat’s
loc_input_container Playwright Locator for the chat input container.
loc_latest_message Playwright Locator for the last message in the chat.
loc_messages Playwright Locator for the chat messages.
page Playwright Page of the Shiny app.

Methods

Name Description
expect_latest_message Expects the last message in the chat.
expect_messages Expects the chat messages.
expect_user_input Expects the user message in the chat.
send_user_input Sends the user message in the chat.
set_user_input Sets the user message in the chat.

expect_latest_message

playwright.controller.Chat.expect_latest_message(value, *, timeout=None)

Expects the last message in the chat.

Parameters

value: PatternOrStr

The expected last message.

timeout: Timeout = None

The maximum time to wait for the expectation to pass. Defaults to None.

expect_messages

playwright.controller.Chat.expect_messages(value, *, timeout=None)

Expects the chat messages.

Parameters

value: PatternOrStr

The expected messages.

timeout: Timeout = None

The maximum time to wait for the expectation to pass. Defaults to None.

expect_user_input

playwright.controller.Chat.expect_user_input(value, *, timeout=None)

Expects the user message in the chat.

Parameters

value: PatternOrStr

The expected user message.

timeout: Timeout = None

The maximum time to wait for the expectation to pass. Defaults to None.

send_user_input

playwright.controller.Chat.send_user_input(method='enter', timeout=None)

Sends the user message in the chat.

Parameters

method: Literal[‘enter’, ‘click’] = ‘enter’

The method to send the user message. Defaults to "enter".

timeout: Timeout = None

The maximum time to wait for the chat input to be visible and interactable. Defaults to None.

set_user_input

playwright.controller.Chat.set_user_input(value, *, timeout=None)

Sets the user message in the chat.

Parameters

value: str

The message to send.

timeout: Timeout = None

The maximum time to wait for the chat input to be visible and interactable. Defaults to None.