Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » SWTBOT Spy View(How to find the widget type in SWTBOT)
SWTBOT Spy View [message #1765693] Tue, 13 June 2017 13:11 Go to next message
jyoti Chopade is currently offline jyoti ChopadeFriend
Messages: 2
Registered: May 2017
Junior Member
How to find the widget type in SWTBOT? is there any way to spy object/Widget in SWTBOT as I am not able to find type of widget in my application

[Updated on: Tue, 13 June 2017 13:12]

Report message to a moderator

Re: SWTBOT Spy View [message #1765714 is a reply to message #1765693] Tue, 13 June 2017 17:58 Go to previous messageGo to next message
Patrick Tasse is currently offline Patrick TasseFriend
Messages: 84
Registered: July 2009
Member
Hi Jyoti,

If you are running your application from Eclipse, you can add the SWTBot Spy plug-in (org.eclipse.swtbot.eclipse.spy) to your Run Configuration. You would need to either import that plug-in to your workspace or add it to your .target file. It is part of the "SWTBot IDE Features" feature (org.eclipse.swtbot.ide).

If that doesn't work for you but you can modify your application code for testing, you could just add the following code somewhere (that runs once in the main thread):
        Display.getDefault().addFilter(SWT.MouseHover, new Listener() {
            @Override
            public void handleEvent(Event event) {
                System.out.println(event);
            }
        });


It's possible that your application is using a non-standard widget that is not supported by SWTBot (for example a Nebula custom widget that is composed of standard SWT widgets). In that case you would have to use the standard SWT widget in your SWTBot code, but sometimes that is not possible if the custom widget overrides default widget behavior. See this thread for example.

Patrick
Re: SWTBOT Spy View [message #1766012 is a reply to message #1765714] Wed, 14 June 2017 18:25 Go to previous message
Eclipse UserFriend
And Display has two useful methods to get the control with focus (getFocusControl()) and the control currently under the cursor (getCursorControl()).

Brian.
Previous Topic:Find Display in SWTUtils
Next Topic:StartupRecorder.openRecorder fails with NPE
Goto Forum:
  


Current Time: Thu Apr 25 03:48:16 GMT 2024

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

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

Back to the top