2010年11月21日日曜日

VB.NET WebBrowserでTextBox(InputタグのTextタイプ)に文字列を入力する。

‘GetElementsByNameを使用する方法。

WebBrowser1.Document.All.GetElementsByName(Inputタグのname属性).Item(0).InnerText = 文字列

‘GetElementsByTagNameを使用する方法。class属性がわかっている場合。

Dim e as HtmlElement

For Each e In WebBrowser1.Document.GetElementsByTagName("input")
    If e.GetAttribute(”classname”) = クラス属性 Then
    e.SetAttribute(“value”, 文字列)
        Mate()
        Exit For
    End If
Next

 

‘class以外の属性の時は name  , id , src,  href などをそのまま書けばよい。

0 件のコメント:

コメントを投稿