espresso-test-lib/EspressoInstrumentation/src/com/tomtom/espresso/test/CucumberHelperTestSteps.java
public static void pressButtonWithText(final String buttonText) {
        int retries = 20;
        do {
            try {
                i_see_button_enabled(buttonText, "enabled"); // Only click on enabled buttons
                pressButtonWithTextOnce(buttonText);
                return;
            } catch (final junit.framework.AssertionFailedError e) {
                try { // Retry every half a second during 10 seconds
                    Thread.sleep(RETRY_WAIT);
                } catch (final InterruptedException ex) {
                }
            } catch (final NoMatchingViewException e) {
                try { // Retry every half a second during 10 seconds
                    Thread.sleep(RETRY_WAIT);
                } catch (final InterruptedException ex) {
                }
            } catch (final RuntimeException e) {
                try { // Retry every half a second during 10 seconds
                    Thread.sleep(RETRY_WAIT);
                } catch (final InterruptedException ex) {
                }
            }
        } while (--retries > 0);
        i_see_button_enabled(buttonText, "enabled"); // Only click on enabled buttons
        pressButtonWithTextOnce(buttonText);
    }
/**
     * Try to press a button with some text and retry for 10 seconds in case it's
     * asynchronously loaded This doesn't guarantee the button is visible
     * to the user, for example: user needs to scroll down to press button
     *
     * @param buttonText
     *            Text of the button to press
     */
Try to press a button with some text and retry for 10 seconds in case it's
asynchronously loaded This doesn't guarantee the button is visible
to the user, for example: user needs to scroll down to press button

@param buttonText
Text of the button to press
Try to press a button with some text and retry for 10 seconds in case it ' s asynchronously loaded This doesn ' t guarantee the button is visible to the user for example : user needs to scroll down to press button @param buttonText Text of the button to press
public static void pressButtonWithText(final String buttonText) {
        int retries = 20;
        do {
            try {
                i_see_button_enabled(buttonText, "enabled"); 
                pressButtonWithTextOnce(buttonText);
                return;
            } catch (final junit.framework.AssertionFailedError e) {
                try { 
                    Thread.sleep(RETRY_WAIT);
                } catch (final InterruptedException ex) {
                }
            } catch (final NoMatchingViewException e) {
                try { 
                    Thread.sleep(RETRY_WAIT);
                } catch (final InterruptedException ex) {
                }
            } catch (final RuntimeException e) {
                try { 
                    Thread.sleep(RETRY_WAIT);
                } catch (final InterruptedException ex) {
                }
            }
        } while (--retries > 0);
        i_see_button_enabled(buttonText, "enabled"); 
        pressButtonWithTextOnce(buttonText);
    }
public static void pressButtonWithText ( final String buttonText ) { int retries = 20 ; do { try { i_see_button_enabled ( buttonText , "enabled" ) ; pressButtonWithTextOnce ( buttonText ) ; return ; } catch ( final junit . framework . AssertionFailedError e ) { try { Thread . sleep ( RETRY_WAIT ) ; } catch ( final InterruptedException ex ) { } } catch ( final NoMatchingViewException e ) { try { Thread . sleep ( RETRY_WAIT ) ; } catch ( final InterruptedException ex ) { } } catch ( final RuntimeException e ) { try { Thread . sleep ( RETRY_WAIT ) ; } catch ( final InterruptedException ex ) { } } } while ( -- retries > 0 ) ; i_see_button_enabled ( buttonText , "enabled" ) ; pressButtonWithTextOnce ( buttonText ) ; }
Try to press a button with some text and retry for 10 seconds in case it's
 asynchronously loaded This doesn't guarantee the button is visible
 to the user, for example: user needs to scroll down to press button
Try to press a button with some text and retry for 10 seconds in case it ' s asynchronously loaded This doesn ' t guarantee the button is visible to the user for example : user needs to scroll down to press button
// Only click on enabled buttons // Retry every half a second during 10 seconds // Retry every half a second during 10 seconds // Retry every half a second during 10 seconds // Only click on enabled buttons