*** title: Selenium WebElement description: Complete WebElement method reference for the Selenium driver. -------------------------------------------------------------------------- All `WebElement` methods available when using the **Selenium** driver. You get a `RemoteWebElement` from `driver.findElement()` or `driver.findElements()`. ## Actions ### click() Click the element. ```ts const el = await runtime.driver.findElement({ css: '#submit' }); await el.click(); ``` *** ### sendKeys(...text) Type text into the element or send key sequences. ```ts await el.sendKeys('hello world'); ``` | Parameter | Type | Required | Description | | --------- | ---------- | -------- | ----------------------------- | | `...text` | `string[]` | Yes | Text or key sequences to send | *** ### clear() Clear the element's value (for input/textarea). ```ts await el.clear(); ``` *** ### submit() Submit the form containing this element. ```ts await el.submit(); ``` *** ## Content ### getText() Get the visible text of the element. ```ts const text = await el.getText(); ``` **Returns** `string` *** ### getAttribute(name) Get an attribute value. ```ts const href = await el.getAttribute('href'); ``` | Parameter | Type | Required | Description | | --------- | -------- | -------- | -------------- | | `name` | `string` | Yes | Attribute name | **Returns** `string | null` *** ### getCssValue(propertyName) Get a CSS property value. ```ts const color = await el.getCssValue('background-color'); ``` | Parameter | Type | Required | Description | | -------------- | -------- | -------- | ----------------- | | `propertyName` | `string` | Yes | CSS property name | **Returns** `string` *** ### getTagName() Get the element's tag name. ```ts const tag = await el.getTagName(); // e.g., "div" ``` **Returns** `string` *** ### getRect() Get the element's position and dimensions. ```ts const rect = await el.getRect(); // { x, y, width, height } ``` **Returns** `{ x: number, y: number, width: number, height: number }` *** ## State Checks ### isDisplayed() Check if the element is visible. ```ts const visible = await el.isDisplayed(); ``` **Returns** `boolean` *** ### isEnabled() Check if the element is enabled. ```ts const enabled = await el.isEnabled(); ``` **Returns** `boolean` *** ### isSelected() Check if the element is selected (for checkboxes, radio buttons, options). ```ts const selected = await el.isSelected(); ``` **Returns** `boolean` *** ## Screenshots ### takeScreenshot() Take a screenshot of this specific element. ```ts const base64 = await el.takeScreenshot(); ``` **Returns** `string` — base64-encoded PNG. *** ## Queries ### findElement(locator) Find a child element within this element. ```ts const child = await el.findElement({ css: '.child' }); ``` | Parameter | Type | Required | Description | | --------- | --------- | -------- | --------------- | | `locator` | `Locator` | Yes | Element locator | **Returns** `RemoteWebElement` *** ### findElements(locator) Find all matching child elements within this element. ```ts const children = await el.findElements({ css: '.item' }); ``` | Parameter | Type | Required | Description | | --------- | --------- | -------- | --------------- | | `locator` | `Locator` | Yes | Element locator | **Returns** `RemoteWebElement[]`