Closed mirceade closed 9 years ago
Which selector did you try when selecting the sub-menu items? text:
, type:
or some complex selector?
It was "text:" but I'll double-check to see if it wasn't more than one component with that text on the screen at that moment.
Please make sure to use a good "narrowing" selector, something like matchingAll( "type:MenuItem", "text:My Text" )
. If this does not work right, I'll have a look, it's possible the search algorithm missed something.
We've tried it with the id selection: fxer.clickOn("#aboutMenuItem") and it DOES move the mouse near the element but not ON the element. It also could be clicking outside it.
We've also tried with a selector: fxer.clickOn(matchingAll("type:MenuItem", "text:About")) and it does not work because we get an exception like this: com.athaydes.automaton.GuiItemNotFound: Could not locate ComplexSelector(matchType:ALL,queries:[type:MenuItem, text:About])
Doing fxer.getAt("#aboutMenuItem") to get a reference of the element works but fxer.getAt(matchingAll("type:MenuItem", "text:About")) throws the same exception:
com.athaydes.automaton.GuiItemNotFound: Could not locate ComplexSelector(matchType:ALL,queries:[type:MenuItem, text:About])
Ok, thank you for all the details. I will fix this as soon as I can. Should release a fix in a few days.
Confirmed the bug. The y-coordinate of the menuItem is incorrect. Affects Java 7 and Java 8.
This bug was caused by a workaround for a JavaFX bug in which the Scene's position was reported incorrectly.
You can remove that workaround by running the following Groovy code in the same JVM where your tests will run:
com.athaydes.automaton.FXAutomaton.metaClass.static.getScenePosition = { Node node ->
new Point( node.scene.x as int, node.scene.y as int )
}
I will publish a fix for this soon, if you prefer to wait.
Hi, we will wait for a proper release because we've already implemented a quite fragile workaround: clicking based on relative coordinates. Thank you for your effort!
Released the fix. Change your Automaton version to 1.2.2.
Fix confirmed.
In JavaFx apps, "clicking" on a menu entry works but clicking on the resulting sub-menu items doesn't. JRE 8 - u 51