我在IE中从下拉列表中选择项目时遇到问题。所有商品都带有“list”标签。
<div class="btn-grp-search">
<input name="1_0" tabindex="0" class="..." role="combobox" aria-labelledby="QueryComboBox_Label">
<span></span>
<ul tabindex="0" class="..." id="id-999" role="combobox">
<li tabindex="-1" class="menu-item" id="id-223" data-lovtype="Blah List Applet:QueryComboBox" data-licval="">Number</li>
<li tabindex="-1" class="menu-item" id="id-224" data-lovtype="Blah List Applet:QueryComboBox" data-licval="">Other</li>
到目前为止,我的不工作解决方案是搜索列表项的ID:
Set objCollection = IE.document.getElementsByTagName("li")
i = 0
While i < objCollection.Length
If objCollection(i).ID = "id-223" Then
objCollection(i).Select
i = objCollection.Length
End If
i = i + 1
Wend
并通过搜索组合框ID
Set objCollection = IE.document.getElementsByTagName("ul")
i = 0
While i < objCollection.Length
If objCollection(i).ID = "id-999" Then
li.Value = "Number"
i = objCollection.Length
End If
i = i + 1
Wend
此搜索结构适用于网页中的其他内容,如填充框等,但对于丢弃,它无法选择项目。