2016-09-20 67 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