Q: Is there a way to access files via a file chooser dialog when running tests on Sauce Labs? I am performing automated cross-browser testing using Selenium and Sauce Labs. The web application under test requires files to be accessed via a file chooser dialog. I'd like to access these files using Selenium while tests are being run by Sauce Labs. When running the tests locally (without the use of Sauce Labs), I am successfully able to interact with the file chooser dialog to access files, but have not been able to do this when the tests are run via Sauce Labs, since I don't know the web element locator for the native file chooser dialog that is presented.
I have the following questions:

*

*Is it possible to upload files to a Sauce Labs virtual machine, to later download them from the filesystem on the virtual machine where the browser is run?

*Is there a way (using Selenium) to interact with the native file chooser dialog that is presented while the test is executing on the Sauce Labs virtual machine? The goal would be to send keyboard input to the file chooser dialog, specifying the path to the file.

I have checked Sauce Labs documentation for information on this.
These are the documents I referenced:
https://support.saucelabs.com/hc/en-us/articles/115003685593-Uploading-Files-to-a-Sauce-Labs-Virtual-Machine-during-a-Test
https://support.saucelabs.com/hc/en-us/articles/115005860628-Testing-PDF-Downloads
Has anyone successfully uploaded files to Sauce Labs, and accessed them during test execution via the native file chooser dialog that is presented?

A: Yes, this is possible, the steps that you need to take are explained in this repository. This example is written with JavaScript, but hopefully you can translate this to your favourite language.
The basic steps are:

*

*The Sauce Labs VM doesn't have access to your local VM, so you need to upload a file to Sauce Labs with a re-run executable. This is a script that will be executed before your selenium test will be started.

*Selenium can't interact with those pop-ups, so you need to set the path of file to be uploaded in the input field. Depending how the the upload field / button has been created you might need to make the input field visible to be able to interact with it. This can be done by injecting some JS into the page and set the element to visible. How this needs to be done depends on how the developers have written the page. There's no silver bullet for this.

