Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » SWTBot Test throws WidgetNotFoundException only when run with Maven
SWTBot Test throws WidgetNotFoundException only when run with Maven [message #1701199] Thu, 09 July 2015 19:20 Go to next message
Robert Smith is currently offline Robert SmithFriend
Messages: 1
Registered: July 2015
Junior Member
I have written a SWTBot test for an Eclipse RCP application which opens Eclipse and then opens a view. When run as an SWTBot test, it runs correctly and passes. However, when run in the project's Maven build using Tycho, it fails with the following error message:

org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException: The widget was null.
	at org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot.<init>(
	at org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBotControl.<init>(
	at org.eclipse.swtbot.swt.finder.widgets.SWTBotShell.<init>(
	at org.eclipse.swtbot.swt.finder.widgets.SWTBotShell.<init>(
	at org.eclipse.swtbot.swt.finder.SWTBotFactory.activeShell(

The line it fails on is:"Window").menu("Show View").menu("Project Explorer").click();

Specifically, it can't find the "Window" menu. It apparently isn't getting an Eclipse window. I have tried explicitly opening a workbench window like so, but it did not change the error:

		UIThreadRunnable.syncExec(new VoidResult() {
			  public void run() {

The test bundle's pom.xml file includes this:

			<!-- Configure the build to handle SWTBot -->

What am I doing wrong and how do I fix it?

Edit: I found the problem. I needed to add the following dependency to my pom.xml file, inside the <configuraiton> node.


With that, Maven opens an Eclipse instance to run the test in, allowing it to succeed.

[Updated on: Fri, 10 July 2015 17:24]

Report message to a moderator

Re: SWTBot Test throws WidgetNotFoundException only when run with Maven [message #1701700 is a reply to message #1701199] Wed, 15 July 2015 06:43 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1808
Registered: July 2009
Location: Firenze, Italy
Senior Member

is the Maven build running in a CI server, e.g., Jenkins?

In that case you must make sure a Window Manager is running (see

hope this helps

Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
Xtext Book:

Previous Topic:SWTBot for Indigo
Next Topic:Still cannot get Mars working with Kali Linux
Goto Forum:

Current Time: Sat Jun 10 20:29:31 GMT 2023

Powered by FUDForum. Page generated in 0.01943 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top