New issue 191 by geoff.ba...@gmail.com: Button clicked twice when using
virtual display
http://code.google.com/p/robotframework-swinglibrary/issues/detail?id=191
Run the attached script on the program provided. If you do so against a
real display, you will see that the button is clicked once as expected. If
you use a virtual display (Xvfb), you will see that it is clicked twice
(note the repeated "Hello World").
$ env CLASSPATH=swinglibrary-1.1.3.jar jython ./testscript.py
Using org.netbeans.jemmy.drivers.DefaultDriverInstaller driver installer
Dialog answered 0
Hello World!
$ Xvfb -ac :58 &
$ env DISPLAY=:58 CLASSPATH=swinglibrary-1.1.3.jar jython ./testscript.py
Using org.netbeans.jemmy.drivers.DefaultDriverInstaller driver installer
Dialog answered 0
Hello World!
Hello World!
I am using RHEL5 linux, SwingLibrary 1.1.3 and JVM 1.6.0.26
Attachments:
testscript.py 486 bytes
sut.py 1.4 KB
Just got bitten by this again on a different app and wondered if you'd
looked at it at all?
Of all the bugs we've submitted, this is by far the most important for us.
The others we have mostly worked around. Extra clicks (which seem capable
of landing just about anywhere, not just clicking the same thing twice) are
more or less impossible to work around...
We've been somewhat busy recently and this dropped to background. I'll see
tomorrow whether there's anything we can do to this.
I converted the example to a RF test case and could also reproduce the bug
with that.
It seems that the extra click behavior happens once, in the first keyword,
after context has been switched from dialog back to main window, but
subsequent keyword behave normally.
I have no idea about the root cause at this point though.
For some truly bizarre reason, it seems that #makeComponentVisible() that
is used by jemmy's AbstarctButtonOperator causes the click in some cases.
I did find a workaround for this, and could probably make a snapshot
release available shortly.
Thanks for your efforts Janne. A snapshot release would be great.
Comment #7 on issue 191 by janne.t.harkonen: Button clicked twice when
using virtual display
http://code.google.com/p/robotframework-swinglibrary/issues/detail?id=191
This issue was updated by revision c04da41c95c8.
I had a little look at the code. I'm a bit concerned that this fix is
eliminating the "correct" click rather than the "extra" one, which might be
a problem in cases where the two clicks hit different buttons (as actually
happens for us most of the time in practice)
I tried to build it myself but gave up after an hour of trying to install
buildr...
Anyway, if you could send me a jar file so I can test this on our real
systems that would be great.
You might be rightfully concerned, and I was actually unable to create a
reliable test case for this. (I tested it with your SUT and it worked
correctly)
I changed our Jenkins build to publish snapshots, you can get latest here:
http://robot.radiaatto.ri.fi/job/RobotFramework-SwingLibrary/
Unfortunately I can confirm that this doesn't help on our real systems. We
still get the extra clicks on different widgets (although it doesn't
eliminate the real clicks, as your additional listener only listens for
extra clicks on the button concerned).
My impression is that the extra click comes in the screen location where
the dialog used to be, so in most real systems it won't hit the same button.
I can also confirm that it does fix the toy test case I provided.
Another thing: in the snapshot both Abbot and Jemmy have been moved inside
org.robotframework, so I have to refer to them as org.robotframework.abbot
and org.robotframework.org.netbeans.jemmy if I want to call them myself
(and most of our workarounds involve calling one or other of these
directly). Is this really intentional? It would be nice to be able to write
code that calls Abbot that doesn't need to know whether the Abbot concerned
is packaged with SwingLibrary.
Comment #11 on issue 191 by janne.t.harkonen: Button clicked twice when
using virtual display
http://code.google.com/p/robotframework-swinglibrary/issues/detail?id=191
Well that's unfortunate.
Since, AFAIK, there's no direct way to control the AWT event queue, I am a
bit at loss about how to fix this, at least without patching jemmy.
I will think about this, and perhaps even try to find out exactly the place
inside jemmy where the additional click is generated, but there are no
guarantees that I am able to fix this, at least for 1.2.
As to the other point, it has always been the intention that the
dependencies of SwingLibrary are under the org.robotframework package, so
that they do not conflict with whatever versions the actual SUT might use.
The version you have seems to be wrongly packaged.
Reopening the issue, since it obviously is not fixed.
One thing to consider is what purpose "makeComponentVisible" actually
serves. Is it necessary to call it at all? As I understood it SwingLibrary
works by doing selectWindow and selectDialog to choose the right windows,
and "makeComponentVisible" seems to be doing that also (somewhat badly...).
In general I think you need a strategy as regards patching Jemmy. I'm
pretty sure the Jemmy project themselves are not fixing bugs. I discussed
this with Pekka before we decided to use SwingLibrary and he generally
suggested maintaining your own copy of Jemmy wouldn't be a problem.
I will do some digging in Jemmy myself also and see if I can make a
testcase with the clicks on different buttons.
As regards packaging, is it really likely that the SUT itself is using
Jemmy or Abbot? In any case, the version I'm using is 1.1.3, the latest
official release, where these are available globally.
I dug the jemmy code a bit more, and to me it seems that using
#makeComponentVisble is unnecessary in our case, since we always insist
that the parent container is selected using `Select *`, which brings the
parent container already to front.
I just removed the #makeComponentVisible() call and at least all of the
SwingLibrary's own tests and the simple test Geoff provided passed.
Can you Geoff test this change against your real world situation?
I have now tested this and it seems to work. Thanks for that! Look forward
to upgrading to 1.2.
Comment #15 on issue 191 by janne.t.harkonen: Button clicked twice when
using virtual display
http://code.google.com/p/robotframework-swinglibrary/issues/detail?id=191
Since the fix has been verified, I'll close this (again).