【问题标题】:SWTBot test to read the Welcome page textSWTBot 测试读取欢迎页面文本
【发布时间】:2013-12-03 12:29:23
【问题描述】:

我正在尝试编写一个 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();
}

【问题讨论】:

标签: java eclipse junit swt swtbot


【解决方案1】:

欢迎页面的内容好像是网站页面...可能现在SWTBot不支持了。

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

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();

希望代码对你有用。

【讨论】:

  • 谢谢你,我正在寻找更具体的东西。
猜你喜欢
  • 2018-01-24
  • 2015-03-28
  • 2012-09-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-28
  • 2019-03-28
相关资源
最近更新 更多