-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MenuItem can't be clicked on #662
Comments
Have you tried waiting for the menu item before tries to click it? |
I didn't. Not sure how would I do it. What I tried is to verify that it is there but it seems like query/lookup method can't fetch |
I would use something like: robot.clickOn("#quitOption"); Please correct me if there is a better way to do this. |
I couldn't make your code compile so I tried the following code snippet FxRobot robot = new FxRobot();
robot.clickOn("#fileMenu");
WaitForAsyncUtils.sleep(2, TimeUnit.SECONDS); I noticed that robot doesn't even click on |
Hi, |
I run it from Eclipse as a JUnit test. If I use your code I get this error message: |
FxRobot robot = new FxRobot();
robot.clickOn("#fileMenu");
WaitForAsyncUtils.waitFor(2, TimeUnit.SECONDS, () ->
robot.lookup("#quitOption").match(NodeQueryUtils.isVisible()).tryQuery().isPresent());
robot.clickOn("#quitOption"); This code works for me. |
Expected Behavior
I would like to test clicking on a menu item. I expected it to work this way:
Actual Behavior
Test fails with an error:
Specifications
Example
FXML file looks like this:
Test code:
I would appreciate any known workarounds. I have tried accessing element with bot
fx:id
andid
but none if those options work.The text was updated successfully, but these errors were encountered: