mil.dod.th.ose.gui.integration/src/mil/dod/th/ose/gui/integration/helpers/GeneralHelper.java
public static void safeClickBySelector(final By selector)
    {
        final WebDriver driver = WebDriverFactory.retrieveWebDriver();
        final Wait<WebDriver> fwait = new FluentWait<WebDriver>(driver).withTimeout(MAXIMUM_WAIT_TIME_SECS, 
                TimeUnit.SECONDS).pollingEvery(1, TimeUnit.SECONDS).ignoring(StaleElementReferenceException.class, 
                        NoSuchElementException.class);
        
        // make sure element is visible first
        fwait.until(ExpectedConditions.elementToBeClickable(selector));
        
        final boolean clicked = fwait.until(new ExpectedCondition<Boolean>()
        {
            @Override
            public Boolean apply(final WebDriver driver)
            {
                driver.findElement(selector).click();
                return true;
            }
        });
        assertThat(clicked, is(true));
    }
/**
     * Try to click the element retrieved by the given selector and allow the element to be stale or non-existent. 
     * Waits up to 10 seconds and retry every second.
     * 
     * @param selector
     *      {@link By} selector that specifies the element to be retrieved directly from the {@link WebDriver}.
     */
Try to click the element retrieved by the given selector and allow the element to be stale or non-existent.
Waits up to 10 seconds and retry every second.

@param selector
By selector that specifies the element to be retrieved directly from the  WebDriver.
Try to click the element retrieved by the given selector and allow the element to be stale or non - existent . Waits up to 10 seconds and retry every second . @param selector By selector that specifies the element to be retrieved directly from the WebDriver .
public static void safeClickBySelector(final By selector)
    {
        final WebDriver driver = WebDriverFactory.retrieveWebDriver();
        final Wait<WebDriver> fwait = new FluentWait<WebDriver>(driver).withTimeout(MAXIMUM_WAIT_TIME_SECS, 
                TimeUnit.SECONDS).pollingEvery(1, TimeUnit.SECONDS).ignoring(StaleElementReferenceException.class, 
                        NoSuchElementException.class);
        fwait.until(ExpectedConditions.elementToBeClickable(selector));
        final boolean clicked = fwait.until(new ExpectedCondition<Boolean>()
        {
            @Override
            public Boolean apply(final WebDriver driver)
            {
                driver.findElement(selector).click();
                return true;
            }
        });
        assertThat(clicked, is(true));
    }
public static void safeClickBySelector ( final By selector ) { final WebDriver driver = WebDriverFactory . retrieveWebDriver ( ) ; final Wait < WebDriver > fwait = new FluentWait < WebDriver > ( driver ) . withTimeout ( MAXIMUM_WAIT_TIME_SECS , TimeUnit . SECONDS ) . pollingEvery ( 1 , TimeUnit . SECONDS ) . ignoring ( StaleElementReferenceException . class , NoSuchElementException . class ) ; fwait . until ( ExpectedConditions . elementToBeClickable ( selector ) ) ; final boolean clicked = fwait . until ( new ExpectedCondition < Boolean > ( ) { @ Override public Boolean apply ( final WebDriver driver ) { driver . findElement ( selector ) . click ( ) ; return true ; } } ) ; assertThat ( clicked , is ( true ) ) ; }
Try to click the element retrieved by the given selector and allow the element to be stale or non-existent.
Try to click the element retrieved by the given selector and allow the element to be stale or non - existent .
// make sure element is visible first