sdk.automation.getdatafromfileinput
Home > @matterway/sdk > Automation > getDataFromFileInput
Automation.getDataFromFileInput() function
Returns the files attached to a file input.
Signature:
export declare function getDataFromFileInput(ctx: Context, selector: string, options?: WaitForSelectorOptions): Promise<File[]>;
Parameters
Parameter | Type | Description |
---|---|---|
ctx | Context | Context object. |
selector | string | Selector for File Input element. |
options | WaitForSelectorOptions | (Optional) |
Returns:
Promise<File[]>
The file as an Array of blobs for files contained in element.
Example
const attachments = await getDataFromFileInput(ctx, '.attachment');
const pdfs = attachments.filter(f => f.type === 'application/pdf');
const invoices = pdfs.filter(f => f.name.startsWith('invoice-'));
// ...