Skip to navigation

Upload files (detailed)

Set the files of a file input, without opening the file dialog. The files replace any the input already holds.

Referenced In

Fields

FieldTypeDescriptionDefault
pathone of:
- string
- array of string
Required. File or files to set. A relative path resolves against the spec file, unless relativePathBase says otherwise. Use a list only for an input that accepts several files.—
timeoutintegerOptional. Max duration in milliseconds to wait for the element to exist. 0 checks once.

Minimum: 0
5000
surfaceone of:
- string
- object(Browser surface)
- object(App surface)
Optional. The browser window or tab this step acts on. Omit to act on the active surface. Specifying a surface switches the active surface for the steps that follow. upload works only in a browser.—
elementTextstringOptional. Display text of the file input’s label. If combined with other element finding fields, the element must match all specified criteria.—
selectorstringOptional. Selector of the file input or its label. If combined with other element finding fields, the element must match all specified criteria.—
elementIdstringOptional. ID attribute of the file input or its label. Supports exact match or regex pattern using /pattern/ syntax.—
elementTestIdstringOptional. data-testid attribute of the file input or its label. Supports exact match or regex pattern using /pattern/ syntax.—
elementClassone of:
- string
- array of string
Optional. Class or array of classes that the element must have. Each class supports exact match or regex pattern using /pattern/ syntax. Element must have all specified classes.—
elementAttributeobjectOptional. Object of attribute key-value pairs that the element must have. Values can be strings (supporting /pattern/ regex), numbers, or booleans. Boolean true matches attribute presence, false matches absence.—
elementAriastringOptional. Computed accessible name of the element per ARIA specification. Supports exact match or regex pattern using /pattern/ syntax.—
frameone of:
- string
- array of string
Optional. Selector of the iframe that holds the element. Use a list for nested iframes, from the outer one to the inner one. The first match is used at each level. Applies to this step only. Works only in a browser.—

Examples

{
"selector": "#avatar",
"path": "avatar.png"
}
{
"elementText": "Choose files",
"path": [
"a.pdf",
"b.pdf"
]
}
{
"elementTestId": "resume",
"path": "files/resume.pdf",
"timeout": 10000
}