Overview
MessageInputElement is a Playwright wrapper for <vaadin-message-input>. It wraps the message input component which contains a text area for composing messages and a send button for submitting them.
Component tag: vaadin-message-input
Implements:
FocusableElementHasEnabledElementHasStyleElementHasThemeElementHasTooltipElement
Constructors
MessageInputElement(Locator locator)
Create a newMessageInputElement from an existing locator.
The Playwright locator for the
<vaadin-message-input> elementInternal Locator Methods
getTextAreaLocator()
Get the locator for the internal<vaadin-text-area>.
Returns: Locator - The text area locator
getTextAreaInputLocator()
Get the locator for the native textarea inside the text area. Returns:Locator - The textarea input locator (slot="textarea")
getSendButtonLocator()
Get the locator for the internal send button. Returns:Locator - The send button locator (<vaadin-message-input-button>)
Value Methods
getValue()
Get the current text area value. Returns:String - The current message text
setValue(String value)
Set the message text by filling the internal textarea input.The message text to set
clear()
Clear the text area by setting the value to an empty string.assertValue(String value)
Assert that the text area input has the expected value.The expected value
Action Methods
submit()
Click the send button to submit the message.submitByEnter()
Press Enter on the text area to submit the message.typeAndSubmit(String message)
Set a message value and then click the send button.The message to type and submit
Send Button Assertion Methods
assertSendButtonVisible()
Assert that the send button is visible.assertSendButtonHidden()
Assert that the send button is hidden.assertSendButtonEnabled()
Assert that the send button is enabled.assertSendButtonDisabled()
Assert that the send button is disabled.I18n Methods
getMessagePlaceholder()
Get the placeholder text on the text area. Returns:String - The placeholder text
assertMessagePlaceholder(String expected)
Assert that the text area placeholder matches the expected text.The expected placeholder text
getSendButtonText()
Get the send button text content. Returns:String - The send button text
assertSendButtonText(String expected)
Assert that the send button text matches the expected text.The expected send button text
Static Factory Methods
get(Page page)
Get the first<vaadin-message-input> on the page.
The Playwright page instance
MessageInputElement - The first message input on the page
get(Locator locator)
Get the first<vaadin-message-input> within a locator scope.
The scope to search within
MessageInputElement - The first message input within the scope
Usage Example
Notes
- The component syncs value between the native textarea and the Vaadin text area
- The send button state is typically controlled by whether the input has content
- Values are usually cleared automatically after successful submission
- The component supports custom I18n for placeholder and button text
- Focus operations target the internal textarea input
Related Elements
- MessageListElement - Display list of messages