[英]Passing parameters through scripting
使用Testcomplete(javascript)实现自动化。
我创建了一个函数:
function SelectDropdownBoxItem(object, property, item)
{
var dropDown = eval(object + "." + FindChild(property, item, 5));
dropDown.Click();
}
还尝试不使用评估...
当我使用类似这样的方法调用方法时:
var AutoAddressSuggestionList = Aliases.b.pageGuidewireClaimc.panelBoundlist.AddressSuggestionList;
SelectDropdownBoxItem(AutoAddressSuggestionList,"contentText","1 Something Street*");
我收到错误“期望的对象” ...我不知道为什么,因为当我运行此方法而不对其进行参数化时,一切正常。
有任何想法吗?
这里不需要eval
; 您可以直接在对象上调用方法:
var dropDown = object.FindChild(property, item, 5);
另外,最好检查一下是否确实找到了列表项:
if (dropDown.Exists) {
dropDown.Click();
}
else {
Log.Error(
"Drop-down list item was not found.",
"Object: " + object.FullName + "\r\n" +
"Item : " + item
);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.