C# で IE を操作
まずはとっかかり。
SMBCフレンド証券のログイン画面のフォーム要素を見つけて値を書き換える。
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using mshtml; namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { wb.Navigate("https://online.smbc-friend.co.jp/smbcfs-front/loginInformation.do"); } private void wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { HtmlDocument doc = wb.Document; HtmlWindow win = doc.Window; // System.Windows.Forms.HtmlWindow HtmlWindowCollection frames = win.Frames; // System.Windows.Forms.HtmlWindowCollection if (frames.Count == 0) { System.Windows.Forms.HtmlElement loginForm = doc.Forms["loginForm"]; if (loginForm != null) { HtmlElementCollection usernames = loginForm.GetElementsByTagName("input"); // input タグ HtmlElement username = usernames["username"]; // お客様コード String value = username.GetAttribute("value"); Console.Out.WriteLine("c = " + value); username.SetAttribute("value", "abc"); } Console.Out.WriteLine("c = " + doc.Window.Frames.Count); } else if (frames.Count == 1) { } else if (frames.Count == 2) { } else { } // Console.Out.WriteLine("c = " + doc.Window.Frames.Count); } } }