I'm trying to get a VB.Net application to type into a file upload control field. The application currently navigates to the correct page, and clicks the "BROWSE" button so the "Choose File" window opens, but when I use SendKeys.Send( "Testing" ), nothing types into the field, even though the cursor is in that field. Is there someting special I need to do to get text into that field? I need to type a value into the field and click the "Open" button to return back to the upload control field. IE8 won't allow typing directly into these "file" type fields anymore.
My Code looks like this:
Public Shared Function GetWindows() As Dictionary(Of String, String)
Dim list As New Dictionary(Of String, String)
For Each window As InternetExplorer In New ShellWindows()
' Skip Windows Explorer instances, since the Document type is IShellFolderViewDual2.
If TypeOf window.Document Is mshtml.HTMLDocument Then
Dim HTMLDoc As mshtml.HTMLDocument
HTMLDoc = window.Document
Dim wbr1 = HTMLDoc.getElementById("upload1")
Dim strId As String
If Not (wbr1 Is Nothing) Then
strId = wbr1.id
wbr1.click()
SendKeys.Send("ABCD")
SendKeys.Send("Testing123")
End If
End If
Next window
Return list
End Function
Please let me know if you need more information. Thank you for your help.
-TIM