在 MSP 中自动填充 Internet Explorer 输入框 - VBA

Automatically filling Internet Explorer inputbox - VBA in MSP

您好,我正在尝试使用 VBA 内的字符串来完成网页上的自由文本字段。我的代码如下。

我做错了什么?

Sub Testing()

Dim objIE As SHDocVw.InternetExplorer

Set objIE = New SHDocVw.InternetExplorer

objIE.Navigate "https://someaddress.com/somepath.do"
objIE.Visible = True
Do Until Not objIE.Busy And objIE.ReadyState = 4
    DoEvents
Loop

objIE.Document.getElementsById("#IO:c0242cf36ff09200b872129e5d3ee445.question_textarea_input cat_item_option").value = "Some String"

End Sub

查看网页上的元素如下

<textarea placeholder="Describe in detail the issue you are experiencing." style="overflow: hidden; word-wrap: break-word; resize: none; height: 64px;" rows="5" id="IO:c0242cf36ff09200b872129e5d3ee445" class="question_textarea_input cat_item_option" onchange="if (typeof(variableOnChange) == 'function') variableOnChange('IO:c0242cf36ff09200b872129e5d3ee445')" name="IO:c0242cf36ff09200b872129e5d3ee445" wrap="soft"></textarea>

感谢任何帮助。

我已经解决了这个问题,但感谢您的帮助。

自由文本字段在 IFrame 中

Sub Testing()

Dim objIE As SHDocVw.InternetExplorer

Set objIE = New SHDocVw.InternetExplorer

objIE.Navigate "https://someaddress.com/somepath.do"
objIE.Visible = True
Do Until Not objIE.Busy And objIE.ReadyState = 4
    DoEvents
Loop

Set objIE = obj.Document.getElementID("anIFrame")
objIE.Document.getElementByID("IO:c0242cf36ff09200b872129e5d3ee445").value = "Some String"

End Sub