0

I have a simple script which is trying to upload a file directly to my application. This test works fine on my local setup (win10 + chrome 73) however when running through browserstack-local (which as I understand sets up a secure connection to my local machine) I am receiving the following error.

Failed: invalid argument: File not found : C:\correctPath/correctFileName.zip
[Chrome #01]         (Session info: chrome=73.0.3683.86)
[Chrome #01]         (Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Windows NT 10.0.15063 x86_64) (WARNING: The server did not provide any stacktrace information)

I am printing out the following confirmations so I know that the paths are correct.

Code

Which produces

[Chrome #01] File Path: C:\correctPath/correctFileName.zip
[Chrome #01] File exists: true

These are printed before the failure occurs.

Note: I can run tests which do not require uploading files fine.

I am brand new to browserstack so there may be something simple I am missing. Any help or advise would be appreicated.


Answer:

Corey pointed me in the right direction with his answer. I needed to add the following two lines to my onPrepare in my config file and I can upload fine now.

const remote = require('selenium-webdriver/remote');
await browser.setFileDetector(new remote.FileDetector());
2
  • please don't post screenshots of code Commented May 1, 2019 at 13:30
  • @Corey I didn't realize they rendered so small after I posted them. I have replaced them with extracts. The middle code snippet I am leaving as it is just for informational purposes Commented May 1, 2019 at 14:20

1 Answer 1

1

see "Local file detector" section at: https://seleniumhq.github.io/docs/remote.html

Local file detector

The Local File Detector allows the transfer of files from the client machine to the remote server. For example, if a test needs to upload a file to a web application, a remote WebDriver can automatically transfer the file from the local machine to the remote web server during runtime. This allows the file to be uploaded from the remote machine running the test.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.