代码 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(
文章来源于领测软件测试网 https://www.ltesting.net/