SDK Reference
Element
Interact with web elements using natural language
The Element
class represents an element in the Dendrite browser environment. It wraps a Playwright Locator and provides methods for interacting with and manipulating elements in the browser.
Methods
outer_html
Retrieves the outer HTML of the element.
Usage
Returns
str
: The outer HTML of the element.
screenshot
Takes a screenshot of the element and returns it as a base64-encoded string.
Usage
Returns
str
: A base64-encoded string of the JPEG image. Returns an empty string if the screenshot fails.
click
Clicks the element.
Usage
Arguments
expected_outcome
(Optional[str]): The expected outcome of the click action.*args
: Additional positional arguments.**kwargs
: Additional keyword arguments.
Returns
InteractionResponse
: The response from the interaction.
fill
Fills the element with a value.
Usage
Arguments
value
(str): The value to fill the element with.expected_outcome
(Optional[str]): The expected outcome of the fill action.*args
: Additional positional arguments.**kwargs
: Additional keyword arguments.
Returns
InteractionResponse
: The response from the interaction.
hover
Hovers over the element.
Usage
Arguments
expected_outcome
(Optional[str]): The expected outcome of the hover action.*args
: Additional positional arguments.**kwargs
: Additional keyword arguments.
Returns
InteractionResponse
: The response from the interaction.
highlight
Highlights the element for debugging purposes.
Usage
This method is useful for visually identifying elements during development and debugging.