I am trying to upload a file automatically using my webBrowser. Let me explain : I have a form with an "input type='file' " element and i am trying to automatically add a file into it.
I already tried this and this and it still doesn't work.
Here is my code :
private void createSystem(string fileUpload)
{
webBrowser1.Navigate("https://test.com/OrderMngt/uploadclient.aspx");
webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser1_DocumentCompleted);
}
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
webBrowser1.Document.GetElementById("UploadFile").Focus();
SendKeys.Send(" C:\\Users\\me\\Downloads\\Upload\\file.csv{ENTER}");
return;
}
The web page is reached, the "Choose File Dialog" is opened but the value oh the path is always empty (except if I fill it manually of course -_- ).
Do you have any idea? Thanks!