@Override
    public Boolean executeCommand(int timeout, String componentName, Object... data) throws QTasteException {
        setData(data);
        long maxTime = System.currentTimeMillis() + 1000 * timeout;
        String buttonText = mData[0].toString();
        component = null;

        while (System.currentTimeMillis() < maxTime) {
            DialogPane targetPopup = null;
            List<Stage> popups = findPopups();
            Collections.reverse(popups);
            for (Stage popup : popups) {
                DialogPane dialogPane = getDialogPane(popup);
                if (!dialogPane.isVisible() || dialogPane.isDisabled()) {
                    String msg = "Ignore the dialog '" + popup.getTitle() + "' cause:\n ";
                    if (!dialogPane.isVisible()) {
                        msg += "\t is not visible";
                    }
                    if (dialogPane.isDisabled()) {
                        msg += "\t is disabled";
                    }
                    LOGGER.info(msg);
                    continue;
                }
                if (activateAndFocusWindow(popup)) {
                    targetPopup = dialogPane;
                    break;
                } else {
                    LOGGER.info("Ignore the dialog '" + popup.getTitle() + "' cause:\n  \t is not focused");
                }
            }

            component = findButton(targetPopup, buttonText);

            if ( component != null && !component.isDisabled() && checkComponentIsVisible(component) )
                break;

            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                LOGGER.warn("Exception during the component search sleep...");
            }
        }

        if (component == null) {
            throw new QTasteTestFailException("The button with the text \"" + buttonText + "\" is not found.");
        }
        if (component.isDisabled()) {
            throw new QTasteTestFailException("The button with the text \"" + buttonText + "\" is disabled.");
        }
        if (!checkComponentIsVisible(component)) {
            throw new QTasteTestFailException("The button with the text \"" + buttonText + "\" is not visible!");
        }

        prepareActions();
        Platform.runLater(this);
        return true;
    }
@ Override public Boolean executeCommand ( int timeout , String componentName , Object ... data ) throws QTasteException { setData ( data ) ; long maxTime = System . currentTimeMillis ( ) + 1000 * timeout ; String buttonText = mData [ 0 ] . toString ( ) ; component = null ; while ( System . currentTimeMillis ( ) < maxTime ) { DialogPane targetPopup = null ; List < Stage > popups = findPopups ( ) ; Collections . reverse ( popups ) ; for ( Stage popup : popups ) { DialogPane dialogPane = getDialogPane ( popup ) ; if ( ! dialogPane . isVisible ( ) || dialogPane . isDisabled ( ) ) { String msg = "Ignore the dialog '" + popup . getTitle ( ) + "' cause:\n " ; if ( ! dialogPane . isVisible ( ) ) { msg += "\t is not visible" ; } if ( dialogPane . isDisabled ( ) ) { msg += "\t is disabled" ; } LOGGER . info ( msg ) ; continue ; } if ( activateAndFocusWindow ( popup ) ) { targetPopup = dialogPane ; break ; } else { LOGGER . info ( "Ignore the dialog '" + popup . getTitle ( ) + "' cause:\n  \t is not focused" ) ; } } component = findButton ( targetPopup , buttonText ) ; if ( component != null && ! component . isDisabled ( ) && checkComponentIsVisible ( component ) ) break ; try { Thread . sleep ( 1000 ) ; } catch ( InterruptedException e ) { LOGGER . warn ( "Exception during the component search sleep..." ) ; } } if ( component == null ) { throw new QTasteTestFailException ( "The button with the text \"" + buttonText + "\" is not found." ) ; } if ( component . isDisabled ( ) ) { throw new QTasteTestFailException ( "The button with the text \"" + buttonText + "\" is disabled." ) ; } if ( ! checkComponentIsVisible ( component ) ) { throw new QTasteTestFailException ( "The button with the text \"" + buttonText + "\" is not visible!" ) ; } prepareActions ( ) ; Platform . runLater ( this ) ; return true ; }
Commander which clicks on a popup button.

@param data INTEGER - the timeout value; String - the button text.
@return true if the command is successfully performed.
@throws QTasteException