Skip to content

Function: setProperty()

ts
function setProperty(
   ctx: Context, 
   selector: string, 
   propertyName: string, 
   value: string, 
options?: WaitForSelectorOptions): Promise<void>;

Defined in: src/dom/index.ts:24

Change the value of an element property.

Parameters

ParameterTypeDescription
ctxContextContext object.
selectorstringCSS or XPath selector for the target element.
propertyNamestringThe attribute name to set.
valuestringThe new attribute value.
options?WaitForSelectorOptionsWait options for the selector lookup.

Returns

Promise<void>

Example

ts
// Disable the "Buy Now" button while the cart loads
await setProperty(ctx, 'button#buy-now', 'disabled', 'true');

Matterway Assistant SDK Documentation