0

I am clicking on a upload button which opens up a windows file selector. I am not able to write the path to a file in that File Selector dialog using protractor.

I tried copying the text to the clipboard and pasting the same to File Upload by passing ctrl+v keypress in protractor. Able to copy the text but paste is not working.

Now I have also used robot-js but not helping me Any idea how can we do this in protractor?

enter image description here

4
  • I don't know if libraries for this exist but I would recommend to just simulate the file upload since protractor is made for testing in the browser. => stackoverflow.com/questions/21305298/… just a thought. Commented Jul 25, 2018 at 12:26
  • i have already tried this Commented Jul 25, 2018 at 13:04
  • The question that Silvan referenced is the only way to upload a file in protractor. If this isn't working for you create a new question with the errors you get from using that method so we can help you with that. Commented Jul 25, 2018 at 14:44
  • after this action element(by.css('input[type="file"]')).sendKeys(absolutePath); -it is taking file in input control, but after this action element(by.id('uploadButton')).click(); -it is again opening window file dialog , so i am thinking , how to enter path in opened window dialog and for press enter i have used this browser.actions().sendKeys(protractor.Key.ENTER); Commented Jul 25, 2018 at 15:56

1 Answer 1

0

Send keys to the input element with your file path, it will do the same flow without opening the windows file pop up

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

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.