Duplicate `JPopupMenuFixture`, macOs, v0.11.7
bric3 opened this issue · comments
Hey I came across, what I think is a bug when rewriting a query to access a menu form the main menu bar.
In order to be able to use script the menu bar I had to pass this system property (apple.laf.useScreenMenuBar=false
) as mentioned in my comment #17 (comment)
I wrote this code
robot.find(byXpath("//div[@text='${path[0]}']//div[@text='${path[1]}']"))
And when replacing it with JPopupMenuFixture
, the find
method failed because two fixtures of the same menu showed up.
To workaround this I replaced find
by findAll
and taking the first item.
attempt(tries = 3) {
menuBar.select(path[0])
}
return robot.findAll<JPopupMenuFixture>(JPopupMenuFixture.byContainsItem(path[1]))
.map { it.menuItem(path[1]) }
.firstOrNull() // select the first item