mil.dod.th.ose.gui.integration/src/mil/dod/th/ose/gui/integration/helpers/NavigationHelper.java
public static void navigateToPage(final WebDriver driver, final String buttonId) throws InterruptedException
    {
        String xpathSearch = String.format("//button[contains(@id, '%s')]", buttonId );
        
        WebDriverWait wait = new WebDriverWait(driver, 30);
        wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("div#navigationLayout")));
        
        boolean leftCollapsed = false;
        //Checks if the left side bar is collapsed. If it is collapsed then it will expand it so that the navigation
        //buttons can be reached.
        final WebElement navBar = 
                GeneralHelper.safeFindElement(null, By.cssSelector("div#navigationLayout"));
        if (!navBar.isDisplayed())
        {
            leftCollapsed = true;
            expandLeftSideBarOnly(driver);
        }
        
        //Retrieve and write javascript log statements before navigating.
        JsLogHelper.updateJSLog(driver);
        
        //Find and click the desired navigation button.
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(xpathSearch)));
        WebElement pageButton = driver.findElement(By.xpath(xpathSearch));
        assertThat(pageButton, is(notNullValue()));
        pageButton.click();
        
        //Wait until the page has been navigated to.
        wait.until(new ExpectedCondition<Boolean>()
        {
            @Override
            public Boolean apply(WebDriver driver)
            {
                return driver.getCurrentUrl().contains(m_NavMap.get(buttonId));
            }
        });
        
        //Checks to see left side bar was collapsed when this method was called. If it was then this method makes sure
        //that the side bar is collapsed before returning.
        wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("div#navigationLayout")));
        if (leftCollapsed)
        {
            //Sleep needed since page may have just loaded and side bar may not be able to be interacted with.
            Thread.sleep(1000);
            collapseLeftBarOnly(driver);
        }
        
        // TD: sleep to allow remote commands to perform AJAX updates of the page on loading see $(document).ready 
        // functions in push JavaScript, if those AJAX updates could be removed, this probably wouldn't be necessary
        GeneralHelper.sleepWithText(4, "Waiting for page load");
    }
/**
     * Navigates the web driver to a specified web page based on button id. This method will open the left side bar if 
     * it is not already open and will return the side bar back to the state it was in when this method was called.
     * 
     * @param driver
     *  web driver that is performing the navigation
     *  
     * @param buttonId
     *  the id of the button that must be utilized to perform the 
     *  navigation
     */
Navigates the web driver to a specified web page based on button id. This method will open the left side bar if
it is not already open and will return the side bar back to the state it was in when this method was called.

@param driver
web driver that is performing the navigation

@param buttonId
the id of the button that must be utilized to perform the
navigation
Navigates the web driver to a specified web page based on button id . This method will open the left side bar if it is not already open and will return the side bar back to the state it was in when this method was called . @param driver web driver that is performing the navigation @param buttonId the id of the button that must be utilized to perform the navigation
public static void navigateToPage(final WebDriver driver, final String buttonId) throws InterruptedException
    {
        String xpathSearch = String.format("//button[contains(@id, '%s')]", buttonId );
        WebDriverWait wait = new WebDriverWait(driver, 30);
        wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("div#navigationLayout")));
        boolean leftCollapsed = false;
        final WebElement navBar = 
                GeneralHelper.safeFindElement(null, By.cssSelector("div#navigationLayout"));
        if (!navBar.isDisplayed())
        {
            leftCollapsed = true;
            expandLeftSideBarOnly(driver);
        }
        JsLogHelper.updateJSLog(driver);
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(xpathSearch)));
        WebElement pageButton = driver.findElement(By.xpath(xpathSearch));
        assertThat(pageButton, is(notNullValue()));
        pageButton.click();
        wait.until(new ExpectedCondition<Boolean>()
        {
            @Override
            public Boolean apply(WebDriver driver)
            {
                return driver.getCurrentUrl().contains(m_NavMap.get(buttonId));
            }
        });
        wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("div#navigationLayout")));
        if (leftCollapsed)
        {
            Thread.sleep(1000);
            collapseLeftBarOnly(driver);
        }
        GeneralHelper.sleepWithText(4, "Waiting for page load");
    }
public static void navigateToPage ( final WebDriver driver , final String buttonId ) throws InterruptedException { String xpathSearch = String . format ( "//button[contains(@id, '%s')]" , buttonId ) ; WebDriverWait wait = new WebDriverWait ( driver , 30 ) ; wait . until ( ExpectedConditions . presenceOfElementLocated ( By . cssSelector ( "div#navigationLayout" ) ) ) ; boolean leftCollapsed = false ; final WebElement navBar = GeneralHelper . safeFindElement ( null , By . cssSelector ( "div#navigationLayout" ) ) ; if ( ! navBar . isDisplayed ( ) ) { leftCollapsed = true ; expandLeftSideBarOnly ( driver ) ; } JsLogHelper . updateJSLog ( driver ) ; wait . until ( ExpectedConditions . visibilityOfElementLocated ( By . xpath ( xpathSearch ) ) ) ; WebElement pageButton = driver . findElement ( By . xpath ( xpathSearch ) ) ; assertThat ( pageButton , is ( notNullValue ( ) ) ) ; pageButton . click ( ) ; wait . until ( new ExpectedCondition < Boolean > ( ) { @ Override public Boolean apply ( WebDriver driver ) { return driver . getCurrentUrl ( ) . contains ( m_NavMap . get ( buttonId ) ) ; } } ) ; wait . until ( ExpectedConditions . presenceOfElementLocated ( By . cssSelector ( "div#navigationLayout" ) ) ) ; if ( leftCollapsed ) { Thread . sleep ( 1000 ) ; collapseLeftBarOnly ( driver ) ; } GeneralHelper . sleepWithText ( 4 , "Waiting for page load" ) ; }
Navigates the web driver to a specified web page based on button id.
Navigates the web driver to a specified web page based on button id .
//Checks if the left side bar is collapsed. If it is collapsed then it will expand it so that the navigation //buttons can be reached. //Retrieve and write javascript log statements before navigating. //Find and click the desired navigation button. //Wait until the page has been navigated to. //Checks to see left side bar was collapsed when this method was called. If it was then this method makes sure //that the side bar is collapsed before returning. //Sleep needed since page may have just loaded and side bar may not be able to be interacted with. // TD: sleep to allow remote commands to perform AJAX updates of the page on loading see $(document).ready  // functions in push JavaScript, if those AJAX updates could be removed, this probably wouldn't be necessary