0

次のコードを使用して、VBScript でボタンをクリックしようとしています。

Set IE = CreateObject("InternetExplorer.Application") 
Set WshShell = WScript.CreateObject("WScript.Shell") 
IE.Navigate "google.com" 
IE.Visible = True 
Wscript.Sleep 2000 
IE.Document.All.Item("uss").Value = "username" 
IE.Document.All.Item("pass").Value = "pass" 
IE.Document.All.Item("character").Value = "character"
IE.Document.All("").Click()

名前のないボタンをクリックするにはどうすればよいですか?

submit選択しようとしているボタンは次のとおりです。

<td colspan="2" align="right"><input type="submit" value="Submit Now!"></td>

ボタンに名前がないことに注意してください。送信機能を使用しようとすると、scipt が機能しないか、Web ページが応答しません。何か案は?

4

1 に答える 1

0

この場合、選択肢がないので、タグ名で取得します。

For Each btn In IE.Document.getElementsByTagName("input")
    If btn.type = "submit" Then btn.Click()
Next
于 2013-03-14T05:16:56.943 に答える