@Test public void select() { ChoiceBox<?> choiceBoxNode = (ChoiceBox<?>) getPrimaryStage().getScene().getRoot().lookup(".choice-box"); Platform.runLater(() -> { choiceBox.marathon_select("Cat"); }); new Wait("Waiting for choice box option to be set.") { @Override public boolean until() { return choiceBoxNode.getSelectionModel().getSelectedIndex() == 1; } }; }
@Override public boolean marathon_select(String value) { ChoiceBox<?> choiceBox = (ChoiceBox<?>) getComponent(); String text = stripHTMLTags(value); int selectedItem = getChoiceBoxItemIndex(choiceBox, text); if (selectedItem == -1) { return false; } choiceBox.getSelectionModel().select(selectedItem); return true; }
JavaFXChoiceBoxElement extends JavaFXElement { @Override public boolean marathon_select(String value) { ChoiceBox<?> choiceBox = (ChoiceBox<?>) getComponent(); String text = stripHTMLTags(value); int selectedItem = getChoiceBoxItemIndex(choiceBox, text); if (selectedItem == -1) { return false; } choiceBox.getSelectionModel().select(selectedItem); return true; } }
JavaFXChoiceBoxElement extends JavaFXElement { @Override public boolean marathon_select(String value) { ChoiceBox<?> choiceBox = (ChoiceBox<?>) getComponent(); String text = stripHTMLTags(value); int selectedItem = getChoiceBoxItemIndex(choiceBox, text); if (selectedItem == -1) { return false; } choiceBox.getSelectionModel().select(selectedItem); return true; } JavaFXChoiceBoxElement(Node component, IJavaFXAgent driver, JFXWindow window); }
JavaFXChoiceBoxElement extends JavaFXElement { @Override public boolean marathon_select(String value) { ChoiceBox<?> choiceBox = (ChoiceBox<?>) getComponent(); String text = stripHTMLTags(value); int selectedItem = getChoiceBoxItemIndex(choiceBox, text); if (selectedItem == -1) { return false; } choiceBox.getSelectionModel().select(selectedItem); return true; } JavaFXChoiceBoxElement(Node component, IJavaFXAgent driver, JFXWindow window); @Override List<IJavaFXElement> getByPseudoElement(String selector, Object[] params); @Override boolean marathon_select(String value); String getContent(); @Override String _getText(); }
JavaFXChoiceBoxElement extends JavaFXElement { @Override public boolean marathon_select(String value) { ChoiceBox<?> choiceBox = (ChoiceBox<?>) getComponent(); String text = stripHTMLTags(value); int selectedItem = getChoiceBoxItemIndex(choiceBox, text); if (selectedItem == -1) { return false; } choiceBox.getSelectionModel().select(selectedItem); return true; } JavaFXChoiceBoxElement(Node component, IJavaFXAgent driver, JFXWindow window); @Override List<IJavaFXElement> getByPseudoElement(String selector, Object[] params); @Override boolean marathon_select(String value); String getContent(); @Override String _getText(); static final Logger LOGGER; }