0

I'm trying to upload a file in a nightwatch test that is being run on Browserstack in IE11. Here is what I have:

browser.execute(function (data) {
  const el = document.querySelector('input#fileUpload');
  el.style.display = "block";
  el.removeAttribute('multiple');
}, []);

browser.setValue('input#fileUpload', require('path').resolve(__dirname + '/upload-files/test-doc.pdf'))

The error is a file not found issue, it works fine when being run on Chrome locally. Searching around, it seems like I need to upload the file to BS first, I found this gist and this PR but neither worked for me.

Ben
  • 1,525
  • 11
  • 19

1 Answers1

0

Since the file is not present on the machine of BrowserStack you might be encountering this error. You will need to use the 'setFileDetector' method provided by Selenium to upload a local file to remote grid. More details can be found on their documentation here - https://www.browserstack.com/automate/node#enhancements-uploads-downloads

Ozone17
  • 138
  • 7
  • Yes, i've also read that but i'm unsure how that translates into nightwatch, which doesn't seem to expose the underlying driver imported by that code directly. – Ben Sep 18 '19 at 23:52
  • @ben any newer findings about this issue? Did you fix it? – sk_user Aug 19 '20 at 19:40