Overview
@PlaywrightElement is a runtime annotation used to associate a Drama Finder element class with its corresponding Vaadin component HTML tag name. This annotation is applied to element wrapper classes that extend VaadinElement.
Annotation Details
ElementType.TYPE
This annotation can only be applied to class declarations
RetentionPolicy.RUNTIME
The annotation is retained at runtime and accessible via reflection
boolean
The annotation is inherited by subclasses
Annotation Parameter
value()
Specifies the HTML tag name for the Vaadin component.String
required
The HTML tag name of the Vaadin component (e.g.,
vaadin-button, vaadin-text-field)String
The tag name for the element
Usage Examples
Basic Usage
With Static Tag Name Constant
Inherited Annotation
Since@PlaywrightElement is marked with @Inherited, subclasses automatically inherit the annotation:
Common Tag Names
Here are some commonly used Vaadin component tag names:Purpose and Benefits
Runtime Introspection
The annotation enables runtime introspection of element classes to determine their associated Vaadin component tag:Framework Integration
The annotation can be used by testing frameworks or tooling to:- Automatically generate locators based on tag names
- Validate that element classes match their corresponding Vaadin components
- Generate documentation or test reports
- Provide IDE autocomplete suggestions
Convention and Documentation
By requiring the annotation on all element classes, Drama Finder ensures:- Consistent naming conventions across element wrappers
- Clear documentation of which Vaadin component each class wraps
- Easy identification of supported components
Notes
- Always define the tag name as a public static final constant (e.g.,
FIELD_TAG_NAME) and reference it in the annotation. - The annotation value should match the exact HTML tag name used by the Vaadin component.
- The
@Inheritedproperty means child classes inherit the annotation, but you may want to override it if the child represents a different tag. - This annotation is required for all classes that extend
VaadinElementin the Drama Finder library.