I am exploring the usage of SWTWorkbenchBot to use in my automation of an eclipse-based project. However, something seems weird when trying to get the "Console" view.
SWTWorkbenchBot workbenchBot = new SWTWorkbenchBot();
String consoleTitle = "Console";
try {
workbenchBot.viewByTitle(consoleTitle).show();
System.out.println("Got the Console view");
} catch (Exception e) {
for (SWTBotView view : workbenchBot.views()) {
System.out.println(view.getTitle() + "\t" + v.getTitle().equals(consoleTitle));
}
}
From the above code, I assume one of the following 2 cases holds:
- Either the code will exit with "Got the Console view" message printed
- Or the message "Got the Console view" message NOT printed because the "Console" view was not found and an exception of type
WidgetNotFoundException
is thrown and the code inside thecatch
will be executed. The output should NOT contain the title "Console" or at least, next to all view titles,false
should be printed.
Surprisingly, this is not happening. The message "Got the Console view" is NOT printed, yet if you look at the list of the view, you see that there exists a line Console true which means that the SWTWorkbenchBot could not get the console view using the method .viewByTitle()
but he knows that exists by checking the .views()
content.
The above code works fine for any view except for the Console view. Am I doing something wrong here? Thanks in advance.