Upload files is not working selenium js

Hi. I stuck with an upload file issue while trying to add this functionality. I have added ‘lambda:userFiles’ key to my capabilities and when I run testing I’m getting next message before my test it even start. How I can fix that? Maybe I put wrong information about Name of your pre run executable or what? Thanks in advance!

Tunnel successfully initiated. You can start testing now
(node:48778) UnhandledPromiseRejectionWarning: WebDriverError: {"message":"Some user file names are invalid","status":"fail"}

I checked out if my files are on cloud and they are

If I change 'lambda:userFiles' : [test.pdf'] to 'userFiles' : [test.pdf'] then I got an File not found error

const macFilePath = '/Users/ltuser/Downloads/test.pdf';
const windowsFilePath = 'C:\\Users\\ltuser\\Downloads\\test.pdf';

Should I use ltuser or my username?

Hello, Greetings from LambdaTest!

You need to use the “lambda:userFiles” capability outside “LT:Options” and with in capability. Like below:

var capabilities = { . LT:Options: {

. . } . . “lambda:userFiles” : [ “test.pdf” ] }

Hello. Thanks for fast reply. I moved userFiles with in capability but I have such error:

do you have any suggestions?

Hello,

The API you are using is not the correct one, you have to use the User File API instead of pre-run API’s to upload the file.

Also, the capability "“lambda:userFiles” : [ “test.pdf” ] " will be in LT:Options only.

1 Like