public static void init(String projectName) throws Exception { SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; Utilities.getDefault().buildProject(projectName); bot = new SWTBot(); SWTBotShell executableShell = null; for (int i = 0, attempts = 100; i < attempts; i++) { for (SWTBotShell shell : bot.shells()) { if (shell.getText().contains("Debug New Executable")) { executableShell = shell; shell.setFocus(); break; } } if (executableShell != null) break; bot.sleep(10); } IPath executablePath = Utilities.getDefault().getProjectPath(projectName).append("a.out"); // $NON-NLS-1$ executableShell.bot().textWithLabel("Binary: ").typeText(executablePath.toOSString()); bot.sleep(2000); executableShell.bot().button("OK").click(); mainShell = null; for (int i = 0, attempts = 100; i < attempts; i++) { for (SWTBotShell shell : bot.shells()) { if (shell.getText().contains("C/C++ Stand-alone Debugger")) { mainShell = shell; shell.setFocus(); break; } } if (mainShell != null) break; bot.sleep(10); } assertNotNull(mainShell); }