📜  c# webbrowser 上传文件 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:55.646000             🧑  作者: Mango

代码示例1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim elements As System.Windows.Forms.HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("input")
        For Each file As HtmlElement In elements
            If file.GetAttribute("name") = "u" Then
                SelectFile()
                file.InvokeMember("Click")
            End If
        Next
    End Sub
    Public Async Sub SelectFile()
        Await Task.Delay(2000)
        SendKeys.Send("Put your file’s name here." + "{ENTER}")
    End Sub