1

I have a test for uploading a file (code below) in my application and testing it locally works perfectly. However, when I test it using BrowserStack, BrowserStack cannot access the file in my local machine.

I have checked their documentation about using BrowserStack with Node.js but I haven't seen any documentation about upload functionality. My question is, how do I tell BrowserStack to access my local file?

Has anyone encountered the same issue before?

this.selectJmxFile = function(jmxFilePath, done){
   this.driver.findElement(webdriver.By.xpath("//input[@type='file']")).sendKeys(jmxFilePath);

   this.driver.wait(function () {
     return driver.isElementPresent(webdriver.By.css('.test.files.msg.right'));
   }, this.timeout).then(function () {
     driver.findElement(webdriver.By.css('.test.files.msg.right')).getText().then(function(text) {
       expect(text).to.equal('1 new file(s) selected');
       done();
     });
   }); 
};

where jmxFilePath is set as:

this.jmxFile = process.cwd() + '/test/functional/features/data/test.jmx'; 

Thanks!

2
  • have you resolved it? Commented Mar 16, 2015 at 16:10
  • No apparently this isn't supported yet by BrowserStack for Node.js Commented Mar 18, 2015 at 9:40

2 Answers 2

2

Ok as it turns out this isn't supported yet as this has only been added in selenium v2.45.0 in Node.js. BrowserStack will have this functionality once they support the latest version of selenium. Guess I have to find another workaround!

Sign up to request clarification or add additional context in comments.

Comments

0

You need to set the file detector and it would be transported to remote Browser Stack machine on which test is running -

 webDriver.setFileDetector(new LocalFileDetector());

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.