IEの自動化

るびま」のWIN32OLEを利用したIEの制御関連の記事を読み、
興味がわいたのでこんなのを作ってみた。

require "win32ole"

ie = WIN32OLE.new("InternetExplorer.Application")
ie.navigate("http://www.trickster.jp/trickster/index.html")
while ie.busy
  sleep 1
end

id = ie.document.getElementByID("id")
id.value = "your_id"
pass = ie.document.getElementByID("pass")
pass.value = "your_password"
button = ie.document.body.all.tags("INPUT").item(4)
button.click
while ie.Busy
  sleep 1
end

ie.navigate("https://ssl2.gcrest.com/trickster/mp/start.php")
ie.visible = true