Time for action – hiding the welcome screen

When Eclipse starts, it typically displays a welcome page. Since this often gets in the way of automated user testing, it is useful to close it at startup.

  1. In the createProject method, within a try block, obtain a view with the title Welcome.
  2. Invoke the close method.
  3. The code will change to look like this:
    SWTWorkbenchBot bot = new SWTWorkbenchBot();
    try {
      bot.viewByTitle("Welcome").close();
    } catch (WidgetNotFoundException e) {
      // ignore
    }
  4. Run the test, and the welcome screen should be closed before the test is run.

What just happened?

Upon startup, the IDE will show a welcome screen. This is shown in a view with a Welcome title.

Using the viewByTitle accessor, the (SWTBot wrapper) view can be accessed. If ...

Get Eclipse Plug-in Development Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.