Block reference / Web interaction

Upload file

Put one or more files into a file input on the page, from your computer, a URL or inline data.

Only inWarpX Browser

Upload file fills an <input type="file"> the way choosing a file in the page's dialog does, without opening the dialog. The files can be on the computer running WarpX Browser, at a web address, or written inline in the block. Use it for profile pictures, documents and attachments, then send the form with Click element.

The Upload file block's settings, filled in as in the example below.

Settings

Element Selector

The file input to fill. It can be hidden: sites often hide theirs behind a styled button, and the block still reaches it. Point at the <input type="file"> itself, not the button. An input inside an iframe works too, after a Switch frame or with a selector that names the frame with |>. Write a CSS selector or an XPath: a value that starts with /, (, @ or id( is read as XPath. The target button lets you click the element in the profile's browser, inside iframes and shadow roots too, and the double tick checks that the selector finds something.

Exampleinput[type="file"][name="avatar"]
Multiple

Puts the same files into every matching file input, not just the first. The block fails only if every input fails.

ExampleUnchecked
Mark elementwhen the selector is CSS, not XPath

Tags each element the block acts on, and skips tagged elements the next time this block runs, so a loop moves on to the next match. Only offered for a CSS selector.

ExampleUnchecked
Wait for selector

Keeps looking for the element until it appears or the timeout runs out. Off, the block looks once.

ExampleChecked
Selector timeout (ms)when Wait for selector is on

How long to keep looking, in milliseconds. The default is 5000.

Example5000
URL/File path/base64

One row per file, added with Add file. Write a full path on the computer running WarpX Browser, such as C:\Users\you\Pictures\avatar.png or file:///C:/Users/you/Pictures/avatar.png; an http:// or https:// address, which the profile's browser downloads first through the profile's proxy; or inline data as name|type|data:, such as note.txt|text/plain|data:text/plain;base64,SGVsbG8=. Each row takes references such as {{variables.avatarPath}}.

Example
C:\Users\you\Pictures\avatar.png
https://cdn.example.com/files/cv.pdf
Delay time (ms)

How long to wait after the block finishes, in milliseconds. Write a range such as 1000,3000 to pick a random wait in it each run.

Example1000

Every block also has the shared block settings — a description, Disable block and what to do on an error, and Finding elements explains selectors in more depth. Fields that take text accept data from earlier blocks.

What it hands on

Nothing is written to the table or variables. The block leaves by its single output once the files are on the input; the page gets them as if you had chosen them yourself. It fails if no input matches, if a path has no file, or if a URL cannot be downloaded.

Example: Change a forum profile picture

  1. Start
  2. Open URL
  3. Upload file
  4. Click element
Where Upload file sits in the example workflow.
  1. Add Open URL after Start with https://forum.example.com/settings/profile.
  2. Add Upload file and set Element Selector to input[type="file"][name="avatar"]. Tick Wait for selector.
  3. Click Add file and write C:\Users\you\Pictures\avatar.png in the new row.
  4. Add Click element after it with button#save-avatar, and tick Wait for selector so the preview has time to appear.
  5. Run the workflow. The picture is put on the input, the page shows its preview, and Click element saves it.
  6. To upload a different picture per profile, write {{variables.avatarPath}} in the row instead and set the variable earlier in the run.

Good to know

  • A path must be the full path to an existing file. One that does not exist, or a relative path, fails the block with No file at and the path.
  • An input without the multiple attribute takes one file. Naming several files for it fails the block with a message that the input takes one file.
  • An empty list fails the block with a message that it names no file to upload.
  • A URL is downloaded by the profile's browser, with the profile's cookies and the page's address as the referrer, and fails if the site answers with an error page (HTTP 400 or above). The file is named after the name the site gives it, or the last part of the address.
  • In an inline name|type|data: row, the file's name comes from the first part and its type follows the name's extension; the middle part is not used.
  • Downloaded and inline files are written to a temporary folder and kept there until the page has read them, since a form may be sent much later in the run. Folders older than a day are removed.
  • Selecting the files does not send them. Most sites upload once you press their own button, so follow the block with Click element.

See also

  • Click element — Click an element on the page, with human-like mouse movement by default.
  • Save assets — Save an image, video, audio or other file to your Downloads folder, from an element or a URL.
  • Switch frame — Run the blocks that follow inside an iframe, or go back to the main page.
  • Handle download — Names the file the page downloads, waits for it, and hands on where it was saved.