Skip to main content



      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 09:11 Go to next message
Eclipse UserFriend
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 09:12] by Moderator

Re: SWTBOT Spy View [message #1765714 is a reply to message #1765693] Tue, 13 June 2017 13:58 Go to previous messageGo to next message
Eclipse UserFriend
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 14: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: Sat May 24 06:16:08 EDT 2025

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

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

Back to the top