Skip to content

Instantly share code, notes, and snippets.

@Xotabu4
Created April 11, 2017 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Xotabu4/13c81465e959974429e2bba9a3408b71 to your computer and use it in GitHub Desktop.
Save Xotabu4/13c81465e959974429e2bba9a3408b71 to your computer and use it in GitHub Desktop.
Usage of FileDetector in protractorjs. Uploading file to remote selenium node
uploadFile(absFilePath) {
const FileDetector = require('selenium-webdriver/remote/index.js').FileDetector;
browser.setFileDetector(new FileDetector());
this.hiddenInputField.sendKeys(absFilePath).then(() => {console.log('Uploading file:', absFilePath)})
// File upload could take a lot of time. Try to use as small file as possible.
browser.wait(your_condition_to_wait, 30000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment