下記のボタンを自動クリックしたいのですが、どうすればよいでしょうか。
※WScript.CreateObject("InternetExplorer.Application")を行った後です。
<input type="image" src="xxx.gif" alt="検索" border="0" onclick="search();return false;" />
ログインしたり入力したりIE上の文字列を引っ張ったりは出来るのですが、type=imageでかつnameが無いとなるとどうすればよいかわからなくなりました。
よろしくお願いします。
imageでaltが"検索"の数が1つの場合ですが
set btn = document.getElementsByTagName("input") for each i in btn if (lcase(i.type) = "image") and (i.alt = "検索") then i.onclick() exit for end if next
複数ある場合は順番が決まっていれば番号指定で、例えば"input"で4番目にある場合
document.getElementsByTagName("input")(3).onclick()
でonclickの内容を実行すると思いますが、IE6での確認だけです。
コメント(1件)
set ie = WScript.CreateObject("InternetExplorer.Application")
だった場合
set btn = ie.document.getElementsByTagName("input")
です。