Skip to content

Function: mwFileFromInput()

ts
function mwFileFromInput(
   ctx: Context, 
   selector: string, 
options?: WaitForSelectorOptions): Promise<MwFile[]>;

Defined in: src/file/getMwFile.tsx:407

Experimental

Return the files attached to a file input element.

Parameters

ParameterTypeDescription
ctxContextContext object.
selectorstringCSS selector or XPath for the file input element.
options?WaitForSelectorOptionsOptions for waiting on the selector.

Returns

Promise<MwFile[]>

An array of MwFile objects from the input.

Example

ts
const attachments = await mwFileFromInput(ctx, '.attachment');
const pdfs = attachments.filter(f => f.type === 'application/pdf');
const invoices = pdfs.filter(f => f.name.startsWith('invoice-'));

Matterway Assistant SDK Documentation