在打印对话中使用RFT识别窗口对象

时间:2014-03-06 21:26:10

标签: rft

为什么RFT无法识别我在Windows打印对话框中显示的对象。包括几张屏幕截图。

我能够通过

获得正确的activeWIndow

TestObject [] to; IWindow activeWindow = RationalTestScript.getScreen()。getActiveWindow(); System.out.println(“活动窗口类为”+ activeWindow.getCLass())://返回#32770

ScreenTestObject root = RootTestObject.getScreenTestObject();

to = root.find(atLIst(atDescendant(“。class”,false),atChild(“。class”,“。Pushbutton”,“。text”,“Print”)));

显然我无法发布图片。这是打印窗口和打印按钮属性截图的链接 http://www.flickr.com/photos/24358027@N07/12977082214/in/set-72157641973533994 ...决议很糟糕,如果有人需要,我可以输入所有信息。对不起,谢谢你。

2 个答案:

答案 0 :(得分:0)

尝试以下代码段。我尝试从记事本启动打印对话框,然后在脚本下面找到打印按钮并单击它。希望它有所帮助。

//Find the Print button
TestObject[] to = find(atDescendant(".class",".Pushbutton",".text","Print"),true);
System.out.println(to.length);
//If you are sure you have just one print button on screen. 
if(to.length==1)
    ((GuiTestObject) to[0]).click();
//Else traverse through the found object and compare the properties of the button you want to click

答案 1 :(得分:0)

更新:我为此做了一个解决方法,使用tab进行导航。一旦Tab在按钮上,我输入Enter。因此,这不再是停工问题,但我确实需要找到正确的方法来做到这一点。 感谢