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");
treeItem.select();
treeItem.contextMenu("Properties").click();

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(SWTBotFactory.java:398)
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBotFactory.java:372)
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBotFactory.java:360)
at org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot.contextMenu(AbstractSWTBot.java:451)
at org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem.contextMenu(SWTBotTreeItem.java:553)
at org.eclipsecon.swtbot.example.CreateProject.configProject(CreateProject.java:79)
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(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner.run(SWTBotJunit4ClassRunner.java:54)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.swtbot.eclipse.core.RemotePluginTestRunner.main(RemotePluginTestRunner.java:64)
at org.eclipse.swtbot.eclipse.core.UITestApplication.runTests(UITestApplication.java:117)
at org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(WorkbenchTestable.java:71)
at java.lang.Thread.run(Unknown 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: Thu Mar 28 21:32:50 GMT 2024

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

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

Back to the top