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
I have tried all the possible solution provided on How to upload file in angularjs e2e protractor testing But no luck . I have added the code below s ,that will redirect you to the problem page ,where i need to upload the file.Thanks in Advance.
describe('NeonMob', function() {
it('LoginUsingInvalidEmail', function() {
browser.get('https://staging.neonmob.com/login');
element(by.id('form-field-username')).click();
element(by.id('field-username')).sendKeys("sharif");
element(by.id('field-password')).sendKeys("1234");
element(by.id('signin-btn')).click();
element(by.css("a[id='primary-navigation--create']")).click();
element(by.id("create-new-amateur-series")).click();
element(by.id("confirm-btn")).click();
element(by.id("creator--add-a-piece-empty")).click();//to click on Add
});
});