【发布时间】:2017-12-06 15:14:32
【问题描述】:
我的 HTML 代码:
<input name="distance[]" required="required" type="text">
使用 QTP 测试软件将元素一一放入 distance[] 数组的相应 VBScript 代码是什么。
我正在尝试这段代码,但它不起作用:
IE.Document.All.("distance[0]").Value= "1"
【问题讨论】:
我的 HTML 代码:
<input name="distance[]" required="required" type="text">
使用 QTP 测试软件将元素一一放入 distance[] 数组的相应 VBScript 代码是什么。
我正在尝试这段代码,但它不起作用:
IE.Document.All.("distance[0]").Value= "1"
【问题讨论】:
仅仅因为你给某个东西命名以一对方括号结尾并不能使它成为一个数组。文本输入字段返回字符串,而不是数组。您需要拆分值以获得实际的数组:
<input name="distance" required="required" type="text">
distance = Split(IE.Documents.All.distance.Value)
WScript.Echo distance(0)
【讨论】: