sdk.automation.fillfilefield
Home > @matterway/sdk > Automation > fillFileField
Automation.fillFileField() function
Attachs a base64 file to a file input field.
Signature:
export declare function fillFileField(ctx: Context, selector: string, fileContent: Base64Data, fileName: File['name'], fileType: File['type'], options?: WaitForSelectorOptions): Promise<void>;
Parameters
Parameter | Type | Description |
---|---|---|
ctx | Context | |
selector | string | The selector for the file input field. |
fileContent | Base64Data | Base64 string data for the file. |
fileName | File['name'] | The name of the file to be uploaded. |
fileType | File['type'] | The file mimetype. |
options | WaitForSelectorOptions | (Optional) |
Returns:
Promise<void>
Example
await fillFileField(ctx, '.attachment', invoiceDocData, `invoice-${date}.pdf`, 'application/pdf');