1

vbscriptを使用してページを読み込もうとしています。次に、入力フィールドにいくつかのダミー値を入力して送信しようとします。

そのためのコードは次のとおりです。

    Dim ie
Set ie = WScript.CreateObject("InternetExplorer.Application")
ie.navigate("http://somepage.com")

ie.width = 900
ie.height = 600
ie.Visible = 1

WScript.sleep(5000)

'Home page of user is loaded.
'Now find the field containing mobile number and type message




    Dim nameField, messageField
    set nameField = ie.document.getElementById("MobileNos")'this line throws error
    nameField.value = "somebody"

    messageField = ie.document.getElementById("Message")
    messageField.value = "Hi"

    'Sending the message
    ie.document.frmpostcomment.submit()

しかし、このコードを実行しようとすると、コメントは投稿されず、代わりにページが更新されます。

前もって感謝します。

4

1 に答える 1

0

フォームの投稿中に私は書くべきだった

ie.document.frmpostcomment.submitbtn.click

これは私のために働いた。

于 2012-07-12T03:51:56.997 に答える