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?