Function mwFileFromInput

  • Experimental

    Returns the files attached to a file input.

    Parameters

    • ctx: Context

      Context object.

    • selector: string

      Selector or XPath for File Input element.

    • Optionaloptions: WaitForSelectorOptions

    Returns Promise<MwFile[]>

    The file as an Array of blobs for files contained in element.

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