0

I'm trying to run an upload file test in protractor on a sauce lab VM, I did some search and I found that exist a fileDetector, but when I tried to use it I get driver.execute is not a function. I think that I'm not passing the driver correctly.

Here is the code that I'm using

const remote = require('selenium-webdriver/remote');
browser.setFileDetector(new remote.FileDetector());
var absolutePath = path.resolve(__dirname, "filePath");
$('input[type="file"]').sendKeys(absolutePath);

Also tried this

const fileDetector = require('selenium-webdriver/remote').FileDetector();
const remotePath = fileDetector.handleFile(browser.driver, PATH_STRING);
browser.driver.setFileDetector(fileDetector);
pageObject.sendKeys(remotePath);

And I get the same the same issue driver.execute is not a function.

Any idea of what can I do to solver this, or other way that I can send the file path to be recognize to sauce lab VM?

  • Try this: https://stackoverflow.com/questions/37459130/how-do-i-upload-a-file-using-protractor/37459222. Are you sure everything is set up correctly? Do you have a test that runs successfully that isn't attempting to upload a file? – JeffC Nov 07 '18 at 16:36
  • Yes, locally runs fine. The problem that I have is when I run the test on sauce labs. – eze vargas Nov 07 '18 at 16:40

0 Answers0