Skip to main content

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

ParameterTypeDescription
ctxContext
selectorstringThe selector for the file input field.
fileContentBase64DataBase64 string data for the file.
fileNameFile['name']The name of the file to be uploaded.
fileTypeFile['type']The file mimetype.
optionsWaitForSelectorOptions(Optional)

Returns:

Promise<void>

Example

await fillFileField(ctx, '.attachment', invoiceDocData, `invoice-${date}.pdf`, 'application/pdf');