Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » method to select a menuItem object for opening Properties window of a project(Alternate methods or approach for opening Properties window of a project in the package explorer using SWTBot)
icon5.gif  method to select a menuItem object for opening Properties window of a project [message #774046] Tue, 03 January 2012 06:52 Go to next message
Padmanabhan Krishnan is currently offline Padmanabhan KrishnanFriend
Messages: 2
Registered: January 2012
Junior Member
I have SWTBot v2.0.5 installed on my Eclipse Helios R2 and I have been exploring SWTBot APIs.I am looking for a work around or alternative approach for a problem that is blocking our exploration with SWTBot.

I am trying to Open the "Properties" window of a project in the package explorer and set configurations parameters with SWTBot. While doing so, I used the "SWTBotMenu org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem.contextMenu(String text)" method to get the "Properties" menu item.

However, I could not get the match with the several text combinations like "Properties","Properties Alt+Enter","Properties Alt+Enter", "Properties Alt+Enter" and so on.I presume that either the text parameter passed is incorrect or the method is not capable to identify it. However, I did see that other menu actions items such as "Close Project","Open Project" were working as expected while using the above method.

It would be great if SWTBot users can share any work around or alternative approach for opening the Properties Window using SWTBot.Though this is a typical issue, I have not been able to identify alternate methods to overcome this problem. Thanks in advance!

Attaching the code snippet and log trace:

SWTBotTree packageExlorerTree = bot.viewByTitle("Project Explorer").bot().tree();
SWTBotTreeItem treeItem =packageExlorerTree.getTreeItem("MyProject");;

Log Trace:
org.eclipse.swtbot.swt.finder.widgets.TimeoutException: Timeout after: 5000 ms.: Could not find context menu with text: Properties Alt+Enter
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(
at org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot.contextMenu(
at org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem.contextMenu(
at org.eclipsecon.swtbot.example.CreateProject.configProject(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(
at org.junit.runners.model.FrameworkMethod.invokeExplosively(
at org.junit.internal.runners.statements.InvokeMethod.evaluate(
at org.junit.runners.BlockJUnit4ClassRunner.runChild(
at org.junit.runners.BlockJUnit4ClassRunner.runChild(
at org.junit.runners.ParentRunner$
at org.junit.runners.ParentRunner$1.schedule(
at org.junit.runners.ParentRunner.runChildren(
at org.junit.runners.ParentRunner.access$000(
at org.junit.runners.ParentRunner$2.evaluate(
at org.junit.internal.runners.statements.RunBefores.evaluate(
at org.junit.internal.runners.statements.RunAfters.evaluate(
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
at org.eclipse.swtbot.eclipse.core.RemotePluginTestRunner.main(
at org.eclipse.swtbot.eclipse.core.UITestApplication.runTests(
at org.eclipse.ui.internal.testing.WorkbenchTestable$
at Source)

[Updated on: Mon, 09 January 2012 11:12]

Report message to a moderator

Re: method to select a menuItem object for opening Properties window of a project [message #780018 is a reply to message #774046] Tue, 17 January 2012 02:14 Go to previous message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
See this page to get information on turning on logging with SWTBot. You will need to tweak the log levels for the matchers package to get more details.

This should give you a lot of information on what SWTBot has found on the UI and what it is trying to match. It's very likely something weird like whitespaces before or after the menu item text or something similar. The debug logs will tell you more.

- Ketan
Previous Topic:Using EclipseSpy View location to find widgets
Next Topic:independent test problem
Goto Forum:

Current Time: Sun May 27 20:00:21 GMT 2018

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

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

Back to the top