I have encountered a situation where I need to click on a button in order to upload a file.

I test this using Selenium C# by:

1. Entering the file path into the box


2. Calling the Javascript function to simulate what happens when “Upload” button is clicked

IJavaScriptExecutor js = driver as IJavaScriptExecutor;

string script = “__doPostBack(‘uploadFileButton’,”)”;