Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » How to click on toolbar dropdown menu item using SWTBOT
How to click on toolbar dropdown menu item using SWTBOT [message #1033456] Thu, 04 April 2013 08:42 Go to next message
Amruta L is currently offline Amruta LFriend
Messages: 1
Registered: April 2013
Junior Member
I am trying to automate the functional testcase of RCP application which requirs to click on menu item from the toolbar dropdown menu. I tried below snippet but it didn't worked, it just clicked on the dropdown menu but menuItems are not getting displayed. Same things works correctly when exeuted manually.


SWTBotToolbarDropDownButton myDropdown = getBot().toolbarDropDownButtonWithTooltip( "My Dropdown" );
SWTBotMenu showMenuItem = myDropdown.menuItem( "Show" );
showMenuItem.click();


This is how the dropdown menu in view toolbar
index.php/fa/14232/0/

and menu items in this menu are
index.php/fa/14233/0/

But when executing the SWTBOT testcase to click 'Show' menu item using above code I am getting the dropdown menu as
index.php/fa/14238/0/

Can some one suggest what might be wrong in above code or is there other way to do this ?


Thanks
Amruta
Re: How to click on toolbar dropdown menu item using SWTBOT [message #1037071 is a reply to message #1033456] Tue, 09 April 2013 06:27 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 827
Registered: July 2009
Location: Grenoble, France
Senior Member

On 04/05/2013 09:19 PM, Amruta L wrote:
> I am trying to automate the functional testcase of RCP application which requirs to click on menu item from the toolbar dropdown menu. I tried below snippet but it didn't worked, it just clicked on the dropdown menu but menuItems are not getting displayed. Same things works correctly when exeuted manually.

Is you application based on Eclipse 4.x ? I think you are hitting this
bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=388306
A change in implementation of menus in Eclipse 4 makes that the sequence
of events generated by SWTBot for some menus does not populate the menu.

I'd really glad if you could have a look to this bug, and maybe provide
a patch or any contribution that would help to get it fixed.

Cheers,
--
Mickael Istria
JBoss, by Red Hat
My blog: http://mickaelistria.wordpress.com
My Tweets: http://twitter.com/mickaelistria
Re: How to click on toolbar dropdown menu item using SWTBOT [message #1758589 is a reply to message #1037071] Thu, 30 March 2017 11:16 Go to previous messageGo to next message
Gunnar Wagenknecht is currently offline Gunnar WagenknechtFriend
Messages: 485
Registered: July 2009
Location: San Francisco ✈ Germany
Senior Member

Is there a trick to close the shell that has been opened by the toolbar drop down button? I tried ESC but probably at the wrong location.
Re: How to click on toolbar dropdown menu item using SWTBOT [message #1758801 is a reply to message #1758589] Mon, 03 April 2017 10:42 Go to previous messageGo to next message
Aparna Argade is currently offline Aparna ArgadeFriend
Messages: 32
Registered: October 2010
Member
Have you tried sending ESC on the toolbarbutton itself?
The following code works for me.
SWTBotToolbarDropDownButton b = bot.toolbarDropDownButtonWithTooltip("tooltip");
b.menuItem("menu").click();
b.pressShortcut(Keystrokes.ESC);
Re: How to click on toolbar dropdown menu item using SWTBOT [message #1758811 is a reply to message #1758801] Mon, 03 April 2017 12:37 Go to previous message
Gunnar Wagenknecht is currently offline Gunnar WagenknechtFriend
Messages: 485
Registered: July 2009
Location: San Francisco ✈ Germany
Senior Member

Aparna Argade wrote on Mon, 03 April 2017 10:42
Have you tried sending ESC on the toolbarbutton itself?
The following code works for me.
SWTBotToolbarDropDownButton b = bot.toolbarDropDownButtonWithTooltip("tooltip");
b.menuItem("menu").click();
b.pressShortcut(Keystrokes.ESC);


That's what I am doing currently but the drop down does not close. It's still open and stays open (Oxygen using SWTBot snapshots). I've opened https://bugs.eclipse.org/514687 with a reproducible test for further investigation.

[Updated on: Tue, 04 April 2017 11:32]

Report message to a moderator

Previous Topic:Execute SWTBot in running IDE
Next Topic:SWTBot support for Nebula TableCombo?
Goto Forum:
  


Current Time: Tue Nov 21 00:35:28 GMT 2017

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

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