Skip to main content

The uploadFile executor

Test the file upload functionality using the uploadFile executor when Send Keys does not work

The Send Keys method is commonly used in automated testing of the file upload functionality. Sometimes, the method does not work as expected with some implementations of the feature.

To handle testing in such cases, BrowserStack provides the uploadFile JavaScript executor. You can use this executor when working with files:

  • Preloaded on BrowserStack remote computers
  • Downloaded to BrowserStack remote computers in an Automate session
  • Preloaded to the BrowserStack server using the Upload media file REST API
  • From your local computer

Presently, the uploadFile executor works with Google Chrome (version 60 and higher) and Microsoft Edge (version 80 and higher) on Windows 10 and Windows 11 only.

The following code samples show how to use the executor:

Copy icon Copy snippet
Copy icon Copy snippet
Copy icon Copy snippet
Copy icon Copy snippet

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback!

Talk to an Expert
Download Copy