TestProject Forum
Powered by leading experts in the test automation community

Upload a local file from a Windows box

Hi there, I need some help in this. This is the situation: I want to upload a local file (.pdf) from c:\documents to attach it to an online form that I am writing. I have used the recording option. I got this far, that a Windows box is opened. I can see the file that I want to upload, but the recording did not registered any step while the Windows box was opened. As expected the test fails, because the Windows box stays open, but nothing further happened.

Hello @carlo.nash and thanks for reaching out to us.

If you’re uploading a file to a site, you should use one of the upload file actions:

After creating the action, you’ll need to specify the XPATH of the element you’re planning to upload your PDF to. It must be an element of type INPUT like in the example above and you’ll also need to specify the local path to the file on your machine.

This action is also available as an element action as well if you hover over an input type element, this one does not require specifying the XPATH:

There’s also a variant for uploading files from your Dropbox drive if you’re interested.

The Windows box is outside the scope of the automation, so these actions should be used instead of clicking on page elements that request file uploads directly.