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

Name Type Description Default
value PatternOrStr The expected last message. required
timeout Timeout The maximum time to wait for the expectation to pass. Defaults to None. None

expect_messages

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

Expects the chat messages.

Parameters

Name Type Description Default
value PatternOrStr The expected messages. required
timeout Timeout The maximum time to wait for the expectation to pass. Defaults to None. None

expect_user_input

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

Expects the user message in the chat.

Parameters

Name Type Description Default
value PatternOrStr The expected user message. required
timeout Timeout The maximum time to wait for the expectation to pass. Defaults to None. None

send_user_input

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

Sends the user message in the chat.

Parameters

Name Type Description Default
method Literal[‘enter’, ‘click’] The method to send the user message. Defaults to "enter". 'enter'
timeout Timeout The maximum time to wait for the chat input to be visible and interactable. Defaults to None. None

set_user_input

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

Sets the user message in the chat.

Parameters

Name Type Description Default
value str The message to send. required
timeout Timeout The maximum time to wait for the chat input to be visible and interactable. Defaults to None. None