@Test public void getText() { List<String> text = new ArrayList<>(); Platform.runLater(() -> { choiceBox.marathon_select("Horse"); text.add(choiceBox.getAttribute("text")); }); new Wait("Waiting for choice box text.") { @Override public boolean until() { return text.size() > 0; } }; AssertJUnit.assertEquals("Horse", text.get(0)); }
@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; }