SWTBot测试以读取欢迎页面文本



我正试图编写一个SWTBot测试,在eclipse中打开欢迎页面视图,然后将内容读取/映射到某个对象中(不在乎是否只有字符串),这样我就可以将其与预期的文本进行比较,我认为这是一个非常琐碎的问题,我会在互联网上找到示例,但我做不到!请帮忙吗?

@Test
public void testExpandText() throws Exception {
    bot.menu(Constants.HELP_MENU).menu(Constants.WELCOME).click();
    welcomePageView = bot.viewByTitle(Constants.WELCOME);
    //expandText();
    //assertText();
    welcomePageView.close();
}

欢迎页面的内容似乎是一个网站页面。。。也许SWTBot现在不支持它。

如果您想查看一些示例测试代码,可以尝试使用以下代码打开"透视"菜单。

bot.menu("Window").menu("Open Perspective").menu("Other...").click();
bot.shell("Open Perspective").activate();
bot.table().select("Debug");
//bot.table().getTableItem(2).getText(); //Get the 2nd line text of the list. 
bot.button("OK").click();

希望这个代码对你有用。

最新更新