参考 @IT様 http://www.atmarkit.co.jp/fdotnet/dotnettips/860controlwb/controlwb.html WebBrowserコントロール内のテキストボックスに文字列をセットするには?[2.0、C#、VB] 2012/05/22記事作成、引用
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace 自動ログイン { public partial class Form1 : Form { public Form1() { InitializeComponent(); } //IDのボタン private void button1_Click(object sender, EventArgs e) { HtmlElementCollection all = webBrowser1.Document.All; HtmlElementCollection forms = all.GetElementsByName("amebaId"); forms[0].InnerText = "アメーバID"; } //アメバトップのボタン private void button4_Click(object sender, EventArgs e) { webBrowser1.Url = new Uri("http://www.ameba.jp/"); } //パスのボタン private void button2_Click(object sender, EventArgs e) { HtmlElementCollection all = webBrowser1.Document.All; HtmlElementCollection forms = all.GetElementsByName("password"); forms[0].InnerText = "アメーバパス"; } //ログインのボタン private void button3_Click(object sender, EventArgs e) { HtmlElementCollection all = webBrowser1.Document.All; HtmlElementCollection forms = all.GetElementsByName("Submit"); forms[0].InvokeMember("click"); } //ログアウトのボタン private void button5_Click(object sender, EventArgs e) { webBrowser1.Url = new Uri("http://www.ameba.jp/logout.do"); } } }