[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [swtbot-dev] Window focus matters?

I've noticed that SWT cares a lot of about focus. OK, interesting. Thanks, I'll try the VM thing.

On Friday, 26 August 2011 at 15:04, Ketan Padegaonkar wrote:

On Fri, Aug 26, 2011 at 4:27 AM, Daniel Lucraft <dan@xxxxxxxxxxxxxxxxx> wrote:
I've got this code (in JRuby):
and this works when the test window is focussed, but fails to find the
widget if it is not focussed. Is there a way to make this work with the
window in the background?
(It'd be nice to be able to run tests in the background, since they take
quite a long time).
Strangely, this part Swt.bot.shell("Redcar") does return an object and then
.bot does return a bot, so its *seems* to be finding the Shell ok. Just then
not the menu.
I'm on OSX Lion if it matters

It is possible to find and perform some actions on widgets in windows
in the background using the api you mention. Unfortunately windowfocus
matters quite a bit with SWT. Menu bars, typing text, auto completes
are things that'll not work as expected with backgrounded windows.

When I had the same problem I usually switch to a different user to
run the tests and switch back to continue work(or startup a 512MB
ubuntu VM). That seemed to do the trick on snow-leopard. Haven't tried
this on Lion.

Would love to hear if it works for you.

-- Ketan
studios.thoughtworks.com | twitter.com/ketanpkr
swtbot-dev mailing list