Appearance
Function: getValue()
ts
function getValue(
ctx: Context,
selector: string,
options?: GetValueOptions): Promise<string>;Defined in: src/form/form.ts:27
Return the value of a form element.
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | Context | Context object. |
selector | string | CSS or XPath selector for the target element. |
options? | GetValueOptions | Options for waiting and querying. Supports root to specify a root element. |
Returns
Promise<string>
The value of the form element as a string.
Example
ts
// Read the customer name from a CRM form
const customerName = await getValue(ctx, 'input[name="customerName"]');
console.log(`Hello, ${customerName}!`);