Vbscript VB脚本选择一个下拉值,而不知道它的技术ID

Vbscript VB脚本选择一个下拉值,而不知道它的技术ID,vbscript,Vbscript,我需要创建一个vb脚本,它将从下拉选择框中选择一个值。 问题是我只知道窗口的名称;窗口或下拉列表的技术ID未知。 我只能通过AppActivate把它带到前面。 我也尝试过使用SendKeys,但它不是一个可编辑的下拉菜单,所以简单地输入值没有帮助 你能帮忙吗 问候,, Suyash Rathi。有太多不知名的员工,但这里有一些东西需要开始 假设我们在hmtl页面中有以下代码: <select> <option value="A">Volvo</option&g

我需要创建一个vb脚本,它将从下拉选择框中选择一个值。 问题是我只知道窗口的名称;窗口或下拉列表的技术ID未知。 我只能通过AppActivate把它带到前面。 我也尝试过使用SendKeys,但它不是一个可编辑的下拉菜单,所以简单地输入值没有帮助

你能帮忙吗

问候,,
Suyash Rathi。

有太多不知名的员工,但这里有一些东西需要开始

假设我们在hmtl页面中有以下代码:

<select>
  <option value="A">Volvo</option>
  <option value="B">Saab</option>
  <option value="C">BMW</option>
  <option value="D" selected>Audi</option>
</select>
在.vbs脚本中添加:

Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
IE.Visible = True
IE.Navigate "http://your_target_url_here.com/"

Do
    WScript.Sleep 100
Loop While IE.ReadyState < 4 And IE.Busy

' get first HTMLSelectElement object:
Set e = Document.getElementsByTagName("select")(0)

' just for undestanding...
MsgBox e.Options(e.selectedIndex).Value '-> "D"
MsgBox e.Options(e.selectedIndex).Text  '-> "Audi"

' select first option:
e.selectedIndex = 0

太多不知名的员工,但这里有一些东西开始

假设我们在hmtl页面中有以下代码:

<select>
  <option value="A">Volvo</option>
  <option value="B">Saab</option>
  <option value="C">BMW</option>
  <option value="D" selected>Audi</option>
</select>
在.vbs脚本中添加:

Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
IE.Visible = True
IE.Navigate "http://your_target_url_here.com/"

Do
    WScript.Sleep 100
Loop While IE.ReadyState < 4 And IE.Busy

' get first HTMLSelectElement object:
Set e = Document.getElementsByTagName("select")(0)

' just for undestanding...
MsgBox e.Options(e.selectedIndex).Value '-> "D"
MsgBox e.Options(e.selectedIndex).Text  '-> "Audi"

' select first option:
e.selectedIndex = 0

你不能从一个特定的下拉列表中选择一个特定的值,因为你对它一无所知。控件是在网页中还是在应用程序中?它是唯一的下拉列表还是其他下拉列表?还有其他区别吗?你不能从一个特定的下拉列表中选择一个特定的值,因为你对这个东西一无所知。控件是在网页中还是在应用程序中?它是唯一的下拉列表还是其他下拉列表?还有其他显著特征吗?