Upload file using protractor typescript

In this post, we will see how to automate uploading a file using protractor typescript,

Uploading file basically need the file path that needs to be uploaded.

we will identify the upload button which upon click pops up the windows dialog to chose the file, in protractor we can achieve this by using sendkeys() and pass the file path as parameter to the method.



We will use a demo site to upload the file

Button “Choose Files” -> el = browser.findElement(by.name("datafile"))

el.sendKeys(fpath) will upload the file present under fpath, hiding the upload dialog


If you are a beginner to protractor typescript and looking for how to run above code, then follow


Content posted is based on learning or working experience,
Share the post with others if find useful,
Any queries?, leave comments or discuss on our facebook:qavalidation.com, Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *