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 this at startup.
createProject()
method, within a try
block obtain a view with the title Welcome
.close()
method.SWTWorkbenchBot bot = new SWTWorkbenchBot(); try { bot.viewByTitle("Welcome").close(); } catch (WidgetNotFoundException e) { // ignore }
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 the view doesn't exist then an exception will be thrown for a safety check; catch any WidgetNotFoundException
since not finding the welcome screen is not a failure.
Having found the welcome page, invoking the close()
method will close the view.