代碼 5. WordWindowVer2.java
package appObject;
……
public class WordWindowVer2 extends TestObject {
// 在 Object Map 中標注為藍色的對象,是 Ribbon 按鈕的最近的父節點
private TestObject ribbonButtonGroupprivate GuiTestObject viewButton;
private GuiTestObject homeButton;
public WordWindowVer2( TestObject testObject ){
super( testObject );
}
// 通過匹配窗口標題找到 Word 窗口
public static WordWindowVer2 getWordWindowVer2( String title ){
RootTestObject root = RootTestObject.getRootTestObject();
TestObject to[] = root.find( RationalTestScript.atDescendant(
".processName", "WINWORD.EXE", ".name", title ) );
return new WordWindowVer2(to[0]);
}
// 從 Word 窗口對象中找到 Ribbon 按鈕組
private TestObject getRibbonButtonGroup(){
if( ribbonButtonGroup == null ){
TestObject to[] = this.find( RationalTestScript.atDescendant(
文章來源于領測軟件測試網 http://www.kjueaiud.com/