【发布时间】:2015-02-04 15:58:12
【问题描述】:
我正在尝试使用以下代码关闭 RFT 中所有打开的 IE 浏览器(作为清理步骤,在执行测试脚本之前)
public void testMain(Object[] args {
RootTestObject root = RootTestObject.getRootTestObject();
{
// Find all TestObjects with a class of HTML Browser
TestObject[] browsers = find(atDescendant(".class","Html.HtmlBrowser"));
ProcessTestObject browserProcess;
System.out.println(browsers.length); //print the number of browsers found
for (int j = 0, j<browsers.length; j++)
{
System.out.println(broswers[j].getProperties()); //print the properties of all browsers found
}
for (int i=0;i<browsers.length;i++)
{
// Get the process of the browser
browserProcess = browsers[i].getProcess();
// Close the browser
browserProcess.kill();
// Unregister the browser object
browserProcess.unregister();
}
}
}
它运行没有错误,但浏览器保持打开状态。
然后我添加了两个打印语句来验证它是否找到了浏览器,我的控制台显示它确实找到并打印了它们的属性。
但由于某种原因,它不会执行“.kill”动作,谁能告诉我我做错了什么?
提前致谢
【问题讨论】: