I have a windows form with a webbrowser control in it. I navigate to a web page & there are many text-controls, combobox - I am able to set value for all of them. There is also an input-file control to select a file from local computer & an Upload submit-button to upload the selected file.
I am not able to set the value for file-control. I have tried SendKeys.Sendwait, but that just doesn't work, even when the webbrowser control has the focus.
Can you please help me on this issue? I need to resolve this urgently. I need the code to select the file automatically by code & then upload it.
Thanks, Amandeep
Loading
Karthi KeyanPosted Jul 29, 2017, 3:47 AM
SenthilkumarPosted Apr 7, 2012, 3:31 AM
I do not think you have any control to assign the value from the code level and trigger the upload method automatically.
If it is web application then we can try in another way. Since it is a windows application.
The web application we can set the value through the javascript.
document.getElementById('fileupload1').value = path;
We can have another button and after assigned it, we can trigger the hidden button event. It will do the upload.
Sam HobbsPosted Apr 6, 2012, 12:35 PM