Transformers File Download Using Saucelabs

I am testing an AngularJS project with a protractor. I have image file download tests that work and transfer correctly on my local Mac. However, when I run the same test through saucelabs, the test fails.

Saucelabs has trouble finding a file and just opens a dialog box, but the file cannot be found. The file is in my test solution, not saucelabs. I was browsing the Internet for answers, but I did not see a definitive answer to this problem. Below is an example of the code that I use to download an image file using an application.

var path = require('path'); it('should upload a file', function() { var fileToUpload = '../some/path/foo.txt', absolutePath = path.resolve(__dirname, fileToUpload); $('input[type="file"]').sendKeys(absolutePath); $('#uploadButton').click(); }); 

Any help or suggestions on how to get the above code to work through Saucelabs will be appreciated.

+5
source share
1 answer

Have you tried something like:

 browser.driver.setFileDetector(new browser.driver.remote.FileDetector); 

According to the protractor problem, this either doesn’t work (error in Selenium JavaScript bindings or protractor, or version mismatch).

The same github release also has a workaround if the main solution does not work (TL; DR: file sharing).

+1
source

All Articles