Skip to main content

AvatarElement

Playwright element wrapper for <vaadin-avatar> providing helpers to read and modify avatar properties (name, abbreviation, image, color index).

Component Tag

vaadin-avatar

Implements

  • FocusableElement - Focus management
  • HasStyleElement - CSS class and style management
  • HasThemeElement - Theme variant support
  • HasTooltipElement - Tooltip text

Constructor

Locator
required
Playwright locator for the <vaadin-avatar> element

Static Factory Methods

get

Get the first avatar on the page or within a scope.
Page
Playwright page
Locator
Scope containing the avatar

getByName

Get an avatar by its name attribute.
Page
Playwright page
Locator
Scope containing the avatar
String
Avatar’s name attribute value

Property Methods

getName

Get the avatar’s name.
Returns the name, or null if not set.

setName

Set the avatar’s name.
String
Name to set

getAbbreviation

Get the displayed abbreviation.
Returns the abbreviation, or null if not set.

setAbbreviation

Set the abbreviation.
String
Abbreviation to display

getImage

Get the image URL.
Returns the image URL, or null if not set.

setImage

Set the image URL.
String
Image URL to set

getColorIndex

Get the background color index.
Returns the color index, or null if not set.

setColorIndex

Set the background color index.
int
Color index to set

Assertion Methods

assertName

Assert the avatar’s name property value.
String
Expected name

assertAbbreviation

Assert the avatar’s abbreviation.
String
Expected abbreviation

assertHasImage

Assert that the avatar has an image set.

assertHasNoImage

Assert that the avatar has no image set.

Usage Examples

Get Avatar and Check Properties

Find Avatar by Name

Set Avatar Properties

Work with Avatar Image

Avatar with Theme

Avatar with Tooltip

Focus Avatar

Scoped Avatar Lookup