Saturday 3 June 2017

How to select the file in native os pop using protractor

I am using protractor to automate my website. I have a scenario where need to upload the file clicking on upload button. When clicked on upload button then it renders the native os popup to select the file.

I tried to upload using below code without clicking on upload button.I think this approach is not correct as the user has to click on upload button and then select the file from native os popup.But still no luck

var fileToUpload = 'filePath';
var absolutePath = path.resolve(__dirname, fileToUpload);
element(by.id("creator--add-a-piece-empty")).sendKeys(absolutePath);

How to select the file in native os pop ? Is there any way to upload

Operating system - Mac siera



via Sharif

No comments:

Post a Comment