Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Showing open editor(s)
Showing open editor(s) [message #17676] Tue, 27 January 2009 09:25 Go to next message
stephanl is currently offline stephanl
Messages: 13
Registered: July 2009
Junior Member
Greetings,

I have two open text editors, named TestClass1.java and TestClass2.java.
TestClass2.java is showing/active. I am executing the following two lines
of code

bot.editor("TestClass.java").show();
bot.editor("TestClass2.java").show();

and experience a WidgetNotFoundException: Could not find widget with text
TestClass.java.

If I manually set the TestClass1.java editor active, the above code will
fail on the second line. Looking at the sample code in the User's Guide
on the swtbot site as well as the API doc, it seems this straight-forward
code should be working to show/activate a given editor by name as
displayed on the tab.

Am I missing something?

Thanks,

- Stephan
Re: Showing open editor(s) [message #17689 is a reply to message #17676] Tue, 27 January 2009 10:29 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
Messages: 873
Registered: July 2009
Senior Member
Can you provide a stack trace ?

-- Ketan

On 27/1/09 19:55, Stephan Lips wrote:
> Greetings,
>
> I have two open text editors, named TestClass1.java and TestClass2.java.
> TestClass2.java is showing/active. I am executing the following two
> lines of code
>
> bot.editor("TestClass.java").show();
> bot.editor("TestClass2.java").show();
>
> and experience a WidgetNotFoundException: Could not find widget with
> text TestClass.java.
>
> If I manually set the TestClass1.java editor active, the above code will
> fail on the second line. Looking at the sample code in the User's Guide
> on the swtbot site as well as the API doc, it seems this
> straight-forward code should be working to show/activate a given editor
> by name as displayed on the tab.
>
> Am I missing something?
>
> Thanks,
>
> - Stephan
>
Re: Showing open editor(s) [message #17714 is a reply to message #17689] Tue, 27 January 2009 10:38 Go to previous messageGo to next message
stephanl is currently offline stephanl
Messages: 13
Registered: July 2009
Junior Member
Absolutely, please see below.

Thanks!

- S

net.sf.swtbot.widgets.WidgetNotFoundException: Could not find widget with
text TestClass.java
at net.sf.swtbot.widgets.AbstractSWTBot.<init>(AbstractSWTBot.java:127)
at net.sf.swtbot.widgets.AbstractSWTBot.<init>(AbstractSWTBot.java:93)
at
net.sf.swtbot.eclipse.finder.widgets.SWTBotView.<init>(SWTBotView.java:81)
at
net.sf.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor.<init >(SWTBotEclipseEditor.java:79)
at
net.sf.swtbot.eclipse.finder.SWTEclipseBot.editor(SWTEclipse Bot.java:53)
at
com.ibm.ws.fabric.studio.swtbot.SimpleTestCase.testEditEndpo int(SimpleTestCase.java:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:64)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at net.sf.swtbot.SWTBotTestCase.runBare(SWTBotTestCase.java:239 )
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestRefer ence.run(JUnit3TestReference.java:130)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
at
org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunne r.main(RemotePluginTestRunner.java:62)
at
net.sf.swtbot.eclipse.ui.TestApplication.runTests(TestApplic ation.java:112)
at
org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(Work benchTestable.java:68)
at java.lang.Thread.run(Thread.java:801)
Caused by: net.sf.swtbot.widgets.TimeoutException: Timeout after: 5000
ms.: Could not find widget
at net.sf.swtbot.SWTBot.waitUntil(SWTBot.java:678)
at net.sf.swtbot.SWTBot.waitUntil(SWTBot.java:639)
at net.sf.swtbot.SWTBot.waitUntil(SWTBot.java:610)
at net.sf.swtbot.widgets.AbstractSWTBot.<init>(AbstractSWTBot.java:114)
... 27 more
Re: Showing open editor(s) [message #17727 is a reply to message #17714] Tue, 27 January 2009 19:46 Go to previous messageGo to next message
Ketan Patel is currently offline Ketan Patel
Messages: 68
Registered: July 2009
Member
It seems to be working ok with SWTBot 2.0. It seems like you are using
1.x. Can you try it with the latest?

http://swtbot.sourceforge.net/artifacts/2.0-eclipse/
Re: Showing open editor(s) [message #18434 is a reply to message #17676] Wed, 28 January 2009 04:17 Go to previous messageGo to next message
Marc is currently offline Marc
Messages: 32
Registered: July 2009
Member
Hi,
Didn't you just miss the "1"?

>named TestClass1.java
bot.editor("TestClass.java").show();


TestClass.java or TestClass1.java ???


Bye
Marc

Stephan Lips wrote:

> Greetings,

> I have two open text editors, named TestClass1.java and TestClass2.java.
> TestClass2.java is showing/active. I am executing the following two lines
> of code

> bot.editor("TestClass.java").show();
> bot.editor("TestClass2.java").show();

> and experience a WidgetNotFoundException: Could not find widget with text
> TestClass.java.

> If I manually set the TestClass1.java editor active, the above code will
> fail on the second line. Looking at the sample code in the User's Guide
> on the swtbot site as well as the API doc, it seems this straight-forward
> code should be working to show/activate a given editor by name as
> displayed on the tab.

> Am I missing something?

> Thanks,

> - Stephan
Re: Showing open editor(s) [message #18436 is a reply to message #18434] Wed, 28 January 2009 16:26 Go to previous messageGo to next message
stephanl is currently offline stephanl
Messages: 13
Registered: July 2009
Junior Member
Thanks for the reply. That '1' was a typo in the post. The actual src
file is named TestClass.java. Good catch though :)

- Stephan
Re: Showing open editor(s) [message #18438 is a reply to message #17727] Wed, 28 January 2009 16:30 Go to previous messageGo to next message
stephanl is currently offline stephanl
Messages: 13
Registered: July 2009
Junior Member
Thanks for the response, Ketan.

I am using swtBot 2.0.0.1164-dev (before was 1.2), and am still seeing the
exact same issue. Exact same error, same stacktrace, down to the line #s
in code.

Any ideas why this would not be working? FWIW, this is running Eclipse
SDK v3.4.1 Build M20080911-1700.

Thanks much!

- Stephan
Re: Showing open editor(s) [message #18456 is a reply to message #18438] Wed, 28 January 2009 20:31 Go to previous message
Ketan Patel is currently offline Ketan Patel
Messages: 68
Registered: July 2009
Member
you still have "net.sf.swtbot.eclipse.finder" package in the stack. If
you do then the old jars are being used since the latest swtbot changed
packages to be org.eclipse.swtbot....
Previous Topic:SWTBot and inputs from file
Next Topic:Accessing pages in an editor
Goto Forum:
  


Current Time: Thu Apr 17 20:53:46 EDT 2014

Powered by FUDForum. Page generated in 0.02900 seconds