我正在尝试编写一个 SWTBot 测试,它在 eclipse 中打开欢迎页面 View ,然后将内容读取/映射到某个对象(不关心是否只有字符串)所以我可以将它与预期的文本进行比较,我认为这是一个非常微不足道的问题,我会在互联网上找到例子,但我不能! 有什么帮助吗?
@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();
希望代码对你有用。
关于java - SWTBot 测试读取欢迎页面文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20351237/