Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 09:57 Go to next message
Дарья Федорова is currently offline Дарья ФедороваFriend
Messages: 6
Registered: May 2021
Junior Member
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 10:23 Go to previous messageGo to next message
Dieter Mai is currently offline Dieter MaiFriend
Messages: 5
Registered: August 2019
Junior Member
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 10:24]

Report message to a moderator

Re: How to click on minimize/maximize view buttons [message #1843075 is a reply to message #1843070] Wed, 14 July 2021 12:46 Go to previous messageGo to next message
Дарья Федорова is currently offline Дарья ФедороваFriend
Messages: 6
Registered: May 2021
Junior Member
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 13:44 Go to previous messageGo to next message
Dieter Mai is currently offline Dieter MaiFriend
Messages: 5
Registered: August 2019
Junior Member
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 14:06 Go to previous messageGo to next message
Дарья Федорова is currently offline Дарья ФедороваFriend
Messages: 6
Registered: May 2021
Junior Member
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 15:07 Go to previous message
Patrick Tasse is currently offline Patrick TasseFriend
Messages: 84
Registered: July 2009
Member
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: Tue Apr 16 04:31:08 GMT 2024

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

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

Back to the top