|Re: Automated test execution without showing display [message #1780464 is a reply to message #1780458]
||Mon, 22 January 2018 19:13
| Patrick Tasse
Registered: July 2009
While most interactions with widgets in SWTBot is done by simulating SWT events, keyboard interaction is different, depending on the strategy (SWTBotPreferences.KEYBOARD_STRATEGY). The default for that preference is to use AWTKeyboardStrategy, which uses java.awt.Robot to send keystrokes to the application, and that should be received by the widget that has keyboard focus.
We too have been noticing more issues with the keyboard lately. It seems that something has changed in the platform or in the window manager, where sometimes no shell has the keyboard focus at all, and keystrokes just get lost. It's like we should no longer assume that when a new shell or dialog is opened, it will automatically get focus, whereas this used to be the case before. There was even a case with SWTBot's own unit tests where the key SPACE needed to be pressed before the widget got keyboard focus... we would tell SWTBot to type "Hello World" and the widget would only receive the keystrokes for "World"...
We have had some luck by making sure tests activate the newly opened shell/dialog with SWTBotShell.activate() before interacting with it. Also, if applicable, make sure that the appropriate widget has keyboard focus.
I hope this helps, and please let us know your findings if you can get your tests to work.
Powered by FUDForum
. Page generated in 0.02442 seconds