2016-09-20 97 views
-1

我想將文本放入網站的文本框中,但我不能。 第一個輸入成功,但出現錯誤:如何將文本添加到文本框?

"An error has occurred in the script on this page, object doesn't support property or method 'addEventListener'" ; "JSON" is undefined and another more..,和另一個參數,當我想要做同樣的事情時,我不能。

我該如何解決?

編輯:在控制檯顯示:「矢量粉碎保護已啓用」

謝謝!

驗證碼:

WebBrowser wb; 
     public BrowserWindow() 
     { 

      int i = 0; 
      Load += delegate 
       { 
        this.wb = new WebBrowser(); 
        this.wb.Dock = DockStyle.Fill; 
        this.Controls.Add(this.wb); 
        this.wb.Visible = true; 
        this.wb.Navigate("http://www.zzz.com/"); 
        this.wb.DocumentCompleted += delegate 
        { 
         if (i == 0) 
         { 
          HtmlElement x = wb.Document.GetElementById("a"); 
          x.InnerText = "b"; 
         } 
         if (i == 1) 
         { 
          HtmlElement y = wb.Document.GetElementById("c"); 
          y.InnerText = "d"; 
         } 
        }; 


       }; 
     } 

回答

0

使用的setAttribute上的HtmlElement

wb.Document.GetElementById("a").SetAttribute("value", "bla bla bla"); 
+0

我已經把:wb.Document.GetElementById( 「A」)的setAttribute( 「值」, 「B」) ; 但我有同樣的結果 我編輯了這個問題,因爲我在控制檯發現它顯示「Vector smash protection is enabled」 – TomaateTip

+0

@TomaateTip你能給出真正的頁面URL嗎? – SBrassard

+0

的URL是www.lufthansa.com – TomaateTip