> For the complete documentation index, see [llms.txt](https://help.autify.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.autify.com/nocode-web/en/when-the-test-doesnt-work/test-issues/i-cannot-upload-files-properly.md). Agents can also search and read this documentation through its [MCP server](https://help.autify.com/~gitbook/mcp).

# I can't record file uploads/tests fail at file upload

## Prerequisites

To record file uploads and run the test, an input element with the type attribute set to "file" must exist in the DOM tree. As long as the input element is present in the DOM tree, it's okay if it's hidden in the CSS settings.

## Causes

If the "Choose File" step is not recorded during file upload operations, or if it is recorded but test execution fails, possible causes are detailed below.

### "Choose File" Step not recorded

#### Input element is not added to the DOM

As mentioned in the prerequisites, an input element with the type attribute set to "file" must exist in the DOM tree to record file upload operations and execute the test.

#### The experimental function `window.showOpenFilePicker()` is used

Autify does not support recording file upload operations using this function. However, you can record the "Choose File" step by running the following JavaScript code in the Developer Tool console before recording file upload operations:

```javascript
window.showOpenFilePicker = () => {
  return Promise.reject(new DOMException("", "SecurityError"))
}
```

{% hint style="warning" %}
**If you are using** [**react-dropzone**](https://react-dropzone.js.org/)

If you are using react-dropzone, you can disable this function by setting [useFsAccessApi](https://react-dropzone.js.org/#:~:text=current%20browser%20window-,useFsAccessApi,-bool) to false.
{% endhint %}

#### The input element is triggered indirectly

If the input element is triggered by clicking an element other than the input element, such as a button element, Autify may not detect the file upload event, and the "Choose File" step may not be recorded.

In this case, you can record the "Choose File" step by following these steps:

1. Click on the target input element using JavaScript in the Developer Tools console.
2. A file selector window appears. Select the appropriate file.

### Recording is successful but test execution fails

If the application under test has been updated and the position or properties of the input element have changed, Autify may not be able to find a matching element, causing the test to fail.

In this case, you may see improvements by re-recording or by using [Quick Element Update](https://help.autify.com/nocode-web/en/autify-university/foundation/test-results/quick-element-update.md).

### Recording or test execution is unreliable

If the input element can only be found at specific times - for example, if it's dynamically generated or added to the DOM tree only during file upload operations - recording and execution may be unreliable.

You can improve this situation by adding the event that causes the input element to be generated/added. For example, by recording "Click the \[Upload File] button".

## Reference Articles

* [File Upload](https://help.autify.com/nocode-web/en/autify-university/foundation/creating-a-scenario/can-i-test-file-upload.md)
* [Autify JavaScript Snippets - Click an element](https://javascript-snippets.autify.com/snippets/mouse/click/)
* [Details on \<input type="file">](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file) (jumps to MDN Web Docs)
* [Introduction to the DOM](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Introduction) (jumps to MDN Web Docs)
* [Window: showOpenFilePicker() method](https://developer.mozilla.org/en-US/docs/Web/API/Window/showOpenFilePicker) (jumps to MDN Web Docs)

If the above does not solve your problem, please contact us via Autify chat.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.autify.com/nocode-web/en/when-the-test-doesnt-work/test-issues/i-cannot-upload-files-properly.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
