1

我想通过 vb.net 2008 编码以编程方式填写表格。表格位于网站的第三页。我正在使用以下代码

Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted

    Dim allelements As HtmlElementCollection = WebBrowser1.Document.All
    Dim txti As HtmlElement = WebBrowser1.Document.GetElementById("txtId")
    Dim txtp As HtmlElement = WebBrowser1.Document.GetElementById("txtPsw")
    Dim txti1 As HtmlElement = WebBrowser1.Document.GetElementById("txtId1")
    Dim txtd As HtmlElement = WebBrowser1.Document.GetElementById("txtDate")
    Dim txtr As HtmlElement = WebBrowser1.Document.GetElementById("txtRegion")
    Dim txte As HtmlElement = WebBrowser1.Document.GetElementById("txtEmail")
    Dim txtt As HtmlElement = WebBrowser1.Document.GetElementById("txtTitle")
    Dim txtu As HtmlElement = WebBrowser1.Document.GetElementById("txtUrl")
    Dim txtp1 As HtmlElement = WebBrowser1.Document.GetElementById("txtPin1")
    Dim txtp2 As HtmlElement = WebBrowser1.Document.GetElementById("txtPin2")
    Dim txtp3 As HtmlElement = WebBrowser1.Document.GetElementById("txtPin3")
    Dim txtp4 As HtmlElement = WebBrowser1.Document.GetElementById("txtPin4")
    Dim txtp5 As HtmlElement = WebBrowser1.Document.GetElementById("txtPin5")
    Dim txtpd As HtmlElement = WebBrowser1.Document.GetElementById("txtData")

    txti.SetAttribute("value", "E712050-15")
    txtp.SetAttribute("value", "HH29")



    txti1.SetAttribute("value", "E712050-15")
    txtd.SetAttribute("value", "")
    txtr.SetAttribute("value", "PAKISTAN")
    txte.SetAttribute("value", "excitedreams@yahoo.com")
    txtt.SetAttribute("value", "Best Classified Business.")
    txtu.SetAttribute("value", "// www.craigslist.org /")
    txtp1.SetAttribute("value", "W")
    txtp2.SetAttribute("value", "X")
    txtp3.SetAttribute("value", "M")
    txtp4.SetAttribute("value", "A")
    txtp5.SetAttribute("value", "F")

结束子

但我的代码无法填写。似乎代码在网站的第一页上有效,但在第三页上无效。如何使它能够填写表格?多谢

4

0 回答 0