Skip to main content



      Home
Home » Eclipse Projects » SWTBot » How to click on minimize/maximize view buttons
How to click on minimize/maximize view buttons [message #1843068] Wed, 14 July 2021 05:57 Go to next message
Eclipse UserFriend
I need to minimize and maximize views in application.
index.php/fa/40753/0/
I tried to record these actions with Recorder and it gave me following instructions:
bot.toolbarButtonWithTooltip("Minimize").click();
bot.toolbarButtonWithTooltip("Maximize").click();
But when i execute it in my tests i see errors says that widget of type toolbar and with tooltip 'minimize' could not be found
Can bot can do it at all?
Re: How to click on minimize/maximize view buttons [message #1843070 is a reply to message #1843068] Wed, 14 July 2021 06:23 Go to previous messageGo to next message
Eclipse UserFriend
I think it should work something like this:
SWTWorkbenchBot bot = new SWTWorkbenchBot();
bot.viewByTitle("Project general"); // or use 'viewById()' if you know the id
SWTBotToolbarButton button = bot.toolbarButton(...);
button.click();

[Updated on: Wed, 14 July 2021 06:24] by Moderator

Re: How to click on minimize/maximize view buttons [message #1843075 is a reply to message #1843070] Wed, 14 July 2021 08:46 Go to previous messageGo to next message
Eclipse UserFriend
unfortunately this method doesn't work. Maybe this can be done on the UI thread(using execSync)?
Re: How to click on minimize/maximize view buttons [message #1843079 is a reply to message #1843075] Wed, 14 July 2021 09:44 Go to previous messageGo to next message
Eclipse UserFriend
I don't know what you mean with "doesn't work"? Which step does not work in which way?
SWTBot will always execute UI actions in the UI thread. So this should be fine.
Re: How to click on minimize/maximize view buttons [message #1843081 is a reply to message #1843079] Wed, 14 July 2021 10:06 Go to previous messageGo to next message
Eclipse UserFriend
It means that the error "couldn't found button with tooltip..." is thrown when bot tries to find buttons minimize or maximize
Re: How to click on minimize/maximize view buttons [message #1843082 is a reply to message #1843081] Wed, 14 July 2021 11:07 Go to previous message
Eclipse UserFriend
I think this does not work because those buttons are not part of the view's toolbar, they are in a special place handled by the TabFolder.

In our project we do this by invoking the 'org.eclipse.ui.window.maximizePart' command handler. You can find our code here:

https://git.eclipse.org/c/tracecompass/org.eclipse.tracecompass.git/tree/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/shared/org/eclipse/tracecompass/tmf/ui/swtbot/tests/shared/SWTBotUtils.java#n1192

In earlier versions we were doing it by pressing the Ctrl+M keyboard shortcut, but switched to invoking the command directly due to intermittent keyboard focus issues.

Hope this helps,
Patrick
Previous Topic:Regression with SWTBot
Next Topic:test rcp application
Goto Forum:
  


Current Time: Wed May 14 12:03:14 EDT 2025

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

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

Back to the top