如何在文本框中添加文字?

时间:2016-09-20 20:21:21

标签: c# webbrowser-control

我想将文本放入网站的文本框中,但我不能。 第一个输入成功,但错误:

"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";
                         }
                     };


                 };
        }

1 个答案:

答案 0 :(得分:0)

在HtmlElement上使用SetAttribute

def my_userarray(users)
  userarray = []
  users.each do |user|
    userarray << user.screen_name
  end
  return userarray
end