Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » SWTBotToolbarButton click does not depress the button on the menubar
SWTBotToolbarButton click does not depress the button on the menubar [message #43742] Thu, 16 July 2009 19:44 Go to next message
lalitha Missing name is currently offline lalitha Missing nameFriend
Messages: 29
Registered: July 2009
Junior Member
As SWTBotToolbarButton click does not depress the button on the menubar.

I.e. the buttons checked state is not getting updated, which is a problem.

Is there a work around for this. Is there a way that through SWTBot we can
set the checked state of the button manually?

Thanks

L.
Re: SWTBotToolbarButton click does not depress the button on the menubar [message #43811 is a reply to message #43742] Thu, 16 July 2009 20:40 Go to previous messageGo to next message
Pascal G is currently offline Pascal GFriend
Messages: 157
Registered: July 2009
Senior Member
lalitha wrote:
> As SWTBotToolbarButton click does not depress the button on the menubar.
>
> I.e. the buttons checked state is not getting updated, which is a problem.
>
> Is there a work around for this. Is there a way that through SWTBot we
> can set the checked state of the button manually?
>
> Thanks
>
> L.
>

There is an open bug for that issue. Take a look at
https://bugs.eclipse.org/bugs/show_bug.cgi?id=282982. Its about toggle
buttons in toolbar, but its pretty the same thing for menus.

--
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Re: SWTBotToolbarButton click does not depress the button on the menubar [message #43872 is a reply to message #43811] Fri, 17 July 2009 06:06 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
This issue has been resolved, please pull in a new build. There's a new
API for dealing with toggleButtons:

bot.toolbarToggleButton()

--
Ketan
http://studios.thoughtworks.com/twist | http://twitter.com/ketanpkr


On 17/7/09 02:10, Pascal Gelinas wrote:
> lalitha wrote:
>> As SWTBotToolbarButton click does not depress the button on the menubar.
>>
>> I.e. the buttons checked state is not getting updated, which is a
>> problem.
>>
>> Is there a work around for this. Is there a way that through SWTBot we
>> can set the checked state of the button manually?
>>
>> Thanks
>>
>> L.
>>
>
> There is an open bug for that issue. Take a look at
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=282982. Its about toggle
> buttons in toolbar, but its pretty the same thing for menus.
>
Re: SWTBotToolbarButton click does not depress the button on the menubar [message #43931 is a reply to message #43872] Fri, 17 July 2009 11:10 Go to previous messageGo to next message
lalitha Missing name is currently offline lalitha Missing nameFriend
Messages: 29
Registered: July 2009
Junior Member
Thanks for the prompt reply and the fix.

L.
Re: SWTBotToolbarButton click does not depress the button on the menubar [message #43961 is a reply to message #43931] Fri, 17 July 2009 15:48 Go to previous messageGo to next message
lalitha Missing name is currently offline lalitha Missing nameFriend
Messages: 29
Registered: July 2009
Junior Member
Hi Ketan,

I downloaded the latest jars, I could see the new methods, but those
methods could not get hold of the toggleCheckedButton. I got widget not
found exception.
I used the editorView.bot().toolbarToggleButtonWithTooltip("the required
tool tip");
I also used all the other methods for toolbarToggleButton provided, but
got the same exception. I used editorView.getToolbarButtons() to get the
button list and checked to see if the style was set to checked and it was.
It showed a Hex value of 32.

I will enclose the inspected value of the btn list.

Thanks,

L.
Re: SWTBotToolbarButton click does not depress the button on the menubar [message #44181 is a reply to message #43961] Mon, 20 July 2009 12:16 Go to previous messageGo to next message
lalitha Missing name is currently offline lalitha Missing nameFriend
Messages: 29
Registered: July 2009
Junior Member
Ketan,

I had emailed the inspected value of the checked button, showing that the
checked value is being set.

Can you please let me know, as to why it is not finding the widget?

Is there a way to directly email to this news portal, if I want to include
images?

Thanks,

L.
Re: SWTBotToolbarButton click does not depress the button on the menubar [message #44211 is a reply to message #44181] Mon, 20 July 2009 12:48 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
It's possible to add attachments, but I'd recommend something like
imagebin.ca to upload images.

--
Ketan
http://studios.thoughtworks.com/twist | http://twitter.com/ketanpkr


On 20/7/09 17:46, lalitha wrote:
> Ketan,
>
> I had emailed the inspected value of the checked button, showing that
> the checked value is being set.
>
> Can you please let me know, as to why it is not finding the widget?
>
> Is there a way to directly email to this news portal, if I want to
> include images?
>
> Thanks,
>
> L.
>
Re: SWTBotToolbarButton click does not depress the button on the menubar [message #44304 is a reply to message #44211] Mon, 20 July 2009 14:36 Go to previous messageGo to next message
lalitha Missing name is currently offline lalitha Missing nameFriend
Messages: 29
Registered: July 2009
Junior Member
Ketan,

Did you see the screen shot that I had sent? Can you let me know why it is
not finding the widget?

Please let me know if there is a work around.

Thanks

L.
Re: SWTBotToolbarButton click does not depress the button on the menubar [message #44489 is a reply to message #44304] Tue, 21 July 2009 13:41 Go to previous messageGo to next message
lalitha Missing name is currently offline lalitha Missing nameFriend
Messages: 29
Registered: July 2009
Junior Member
Hi,

I am getting this error when I am trying to get hold of the
toolbartogglebutton of a view.
The view is already rendered, I do not know why it is timing out while
trying to find the widget?

Here is the code:

bot.activeView().toolbarToggleButton("View/Edit selected service",
0).click();

I also trying using the other methods provided like :

bot.activeView().toolbarToggleButtonWithTooltip("View/Edit selected
service").click();

bot.activeView().toolbarToggleButton("View/Edit selected service",
0).click();


org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundExcep tion: Could
not find widget.
at
org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntilWidgetA ppears(SWTBotFactory.java:346)
at
org.eclipse.swtbot.swt.finder.SWTBotFactory.widget(SWTBotFac tory.java:306)
at
org.eclipse.swtbot.swt.finder.SWTBot.toolbarToggleButton(SWT Bot.java:2681)

Appreciate all the help that I am getting.

Thanks,

L.
Re: SWTBotToolbarButton click does not depress the button on the menubar [message #44519 is a reply to message #44489] Tue, 21 July 2009 19:49 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
On 21/7/09 19:11, lalitha wrote:
> bot.activeView().toolbarToggleButton("View/Edit selected service",
> 0).click();

Are you clicking on the togglebutton in a view toolbar ? Regular buttons
on a view toolbar are supported, not toggle buttons.

--
Ketan
http://studios.thoughtworks.com/twist | http://twitter.com/ketanpkr
Re: SWTBotToolbarButton click does not depress the button on the menubar [message #44750 is a reply to message #44519] Wed, 22 July 2009 12:14 Go to previous messageGo to next message
lalitha Missing name is currently offline lalitha Missing nameFriend
Messages: 29
Registered: July 2009
Junior Member
Ketan,

In this message thread you had the following reply for the toggle button:
I pulled the latest build but am having an issue. Will it be possible for
you to fix this issue and update the build? I truely appreciate your help.

Thanks,

L.

"This issue has been resolved, please pull in a new build. There's a new
API for dealing with toggleButtons:

bot.toolbarToggleButton()

--
Ketan"
Re: SWTBotToolbarButton click does not depress the button on the menubar [message #44777 is a reply to message #44489] Wed, 22 July 2009 12:40 Go to previous messageGo to next message
Benjamin Glaser is currently offline Benjamin GlaserFriend
Messages: 17
Registered: July 2009
Junior Member
Hi,

> bot.activeView().toolbarToggleButtonWithTooltip("View/Edit selected
> service").click();

are you sure, the view is active at the time you perform your click?

I had the same issue (a togglebutton in a toolbar of a view) too.

I used:

bot.toolbarToggleButtonWithTooltip("the tooltip").toggle();

(only works if you have no other button with the same tooltip)
(click() is almost the same because it calls the toggle() methode)

and it worked fine for me.

Greets

Benjamin

PS: Do you use the latest build?
Re: SWTBotToolbarButton click does not depress the button on the menubar [message #44808 is a reply to message #44777] Wed, 22 July 2009 12:45 Go to previous messageGo to next message
Benjamin Glaser is currently offline Benjamin GlaserFriend
Messages: 17
Registered: July 2009
Junior Member
addition:

I focused the view right before the click.

bot.viewByTitle("title").setFocus();

then

bot.toolbarToggleButtonWithTooltip("tooltip").toggle();

That worked!

Benjamin
Re: SWTBotToolbarButton click does not depress the button on the menubar [message #44839 is a reply to message #44808] Wed, 22 July 2009 15:16 Go to previous messageGo to next message
lalitha Missing name is currently offline lalitha Missing nameFriend
Messages: 29
Registered: July 2009
Junior Member
Hi,

Thanks for the below suggestion:
mbot.viewByTitle("title").setFocus();

However when i use the setFocus() method it opens up another view.
I am able to get hold of the view as i am able to close the view by using
mbot.viewByTitle("title").close().

I am using the latest version. 2.0.0.371

Thanks,

L.
Re: SWTBotToolbarButton click does not depress the button on the menubar [message #44909 is a reply to message #44839] Wed, 22 July 2009 16:15 Go to previous messageGo to next message
lalitha Missing name is currently offline lalitha Missing nameFriend
Messages: 29
Registered: July 2009
Junior Member
editorView.toolbarButton("View/Edit selected service").click() finds and
clicks the button but does not depress it. However
editorView.bot().toggleButtonWithTooltip("View/Edit selected
service").click();
or
editorView.bot().toggleButtonWithTooltip("View/Edit selected
service").toggle();

throws the following WidgetNotFoundException.

Any help is appreciated.

L.




here is the stacktrace

org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundExcep tion: Could
not find widget.
at
org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntilWidgetA ppears(SWTBotFactory.java:346)
at
org.eclipse.swtbot.swt.finder.SWTBotFactory.widget(SWTBotFac tory.java:306)
at
org.eclipse.swtbot.swt.finder.SWTBot.toggleButtonWithTooltip (SWTBot.java:775)
at
org.eclipse.swtbot.swt.finder.SWTBot.toggleButtonWithTooltip (SWTBot.java:764)
at
com.compuware.vantage.vsm.client.rcp.swtbottest.RcpSWTBotTes t.testPerspective3(RcpSWTBotTest.java:134)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at
org.eclipse.swtbot.swt.finder.SWTBotTestCase.runBare(SWTBotT estCase.java:228)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at
org.junit.internal.runners.OldTestClassRunner.run(OldTestCla ssRunner.java:76)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:45)
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.swtbot.eclipse.core.RemotePluginTestRunner.main( RemotePluginTestRunner.java:64)
at
org.eclipse.swtbot.eclipse.core.UITestApplication.runTests(U ITestApplication.java:117)
at
org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(Work benchTestable.java:68)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.eclipse.swtbot.swt.finder.widgets.TimeoutException: Timeout
after: 20000 ms.: Could not find widget matching: (of type 'Button' and
with tooltip 'View/Edit selected service' and with style 'SWT.TOGGLE')
at
org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBot Factory.java:396)
at
org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBot Factory.java:370)
at
org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBot Factory.java:358)
at
org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntilWidgetA ppears(SWTBotFactory.java:344)
Re: SWTBotToolbarButton click does not depress the button on the menubar [message #45166 is a reply to message #44909] Thu, 23 July 2009 11:38 Go to previous messageGo to next message
Benjamin Glaser is currently offline Benjamin GlaserFriend
Messages: 17
Registered: July 2009
Junior Member
Just try:

private final SWTWorkbenchBot bot = new SWTWorkbenchBot();

bot.viewByTitle("title").setFocus();
bot.toolbarToggleButtonWithTooltip("tooltip").toggle();

instead of:

> editorView.bot().toggleButtonWithTooltip("View/Edit selected
> service").toggle();

But don't really know if that changes something.

Bye
Benjamin
Re: SWTBotToolbarButton click does not depress the button on the menubar [message #45371 is a reply to message #45166] Mon, 27 July 2009 16:28 Go to previous message
lalitha Missing name is currently offline lalitha Missing nameFriend
Messages: 29
Registered: July 2009
Junior Member
Benjamin,

thanks a bunch.
Your suggestion worked. I used the following code that you had suggested.

private final SWTWorkbenchBot bot = new SWTWorkbenchBot();

bot.toolbarToggleButtonWithTooltip("tooltip").toggle();


Regards,
L.
Previous Topic:Target Executable from the Command Line
Next Topic:Cannot automate login
Goto Forum:
  


Current Time: Fri Apr 19 20:27:27 GMT 2024

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

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

Back to the top