mil.dod.th.ose.gui.integration/src/mil/dod/th/ose/gui/integration/helpers/AssetHelper.java
public static void removeAsset(final WebDriver driver, final String assetName) throws InterruptedException
    {
        WebDriverWait wait = new WebDriverWait(driver, 10);
        
        //Initial page/tab check.
        NavigationHelper.pageAndTabCheck(driver, NavigationButtonNameConstants.NAVBUT_PROP_ASSETS, ASSET_CONFIG_TAB_ID);
        
        Wait<WebDriver> fwait = new FluentWait<WebDriver>(driver).withTimeout(60, TimeUnit.SECONDS).
                pollingEvery(2, TimeUnit.SECONDS).ignoring(StaleElementReferenceException.class, 
                        NoSuchElementException.class);
        
        //Use a fluent wait to insure that the remove asset button actually gets clicked before continuing.
        fwait.until(new ExpectedCondition<Boolean>()
        {
            @Override
            public Boolean apply(WebDriver driver)
            {
                //---remove the asset---
                final WebElement asset = retrieveAsset(driver, assetName);
                if (asset != null)
                {
                    asset.findElement(By.cssSelector("button[id$='removeButton']")).click();
                    return true;
                }
                return false;
            }
        });
        
        //confirm we want to remove the asset
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div[id$='confirmDialog']")));
        driver.findElement(By.cssSelector("button[id$='removeAsset']")).click();
        
        fwait.until(new ExpectedCondition<Boolean>()
        {
            @Override
            public Boolean apply(WebDriver driver)
            {
                return retrieveAsset(driver, assetName) == null;
            }
        });
    }
/**
     * Assuming an asset with the given name is already created and deactivated, remove the asset.
     */
Assuming an asset with the given name is already created and deactivated, remove the asset.
Assuming an asset with the given name is already created and deactivated remove the asset .
public static void removeAsset(final WebDriver driver, final String assetName) throws InterruptedException
    {
        WebDriverWait wait = new WebDriverWait(driver, 10);
        NavigationHelper.pageAndTabCheck(driver, NavigationButtonNameConstants.NAVBUT_PROP_ASSETS, ASSET_CONFIG_TAB_ID);
        Wait<WebDriver> fwait = new FluentWait<WebDriver>(driver).withTimeout(60, TimeUnit.SECONDS).
                pollingEvery(2, TimeUnit.SECONDS).ignoring(StaleElementReferenceException.class, 
                        NoSuchElementException.class);
        fwait.until(new ExpectedCondition<Boolean>()
        {
            @Override
            public Boolean apply(WebDriver driver)
            {
                final WebElement asset = retrieveAsset(driver, assetName);
                if (asset != null)
                {
                    asset.findElement(By.cssSelector("button[id$='removeButton']")).click();
                    return true;
                }
                return false;
            }
        });
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div[id$='confirmDialog']")));
        driver.findElement(By.cssSelector("button[id$='removeAsset']")).click();
        fwait.until(new ExpectedCondition<Boolean>()
        {
            @Override
            public Boolean apply(WebDriver driver)
            {
                return retrieveAsset(driver, assetName) == null;
            }
        });
    }
public static void removeAsset ( final WebDriver driver , final String assetName ) throws InterruptedException { WebDriverWait wait = new WebDriverWait ( driver , 10 ) ; NavigationHelper . pageAndTabCheck ( driver , NavigationButtonNameConstants . NAVBUT_PROP_ASSETS , ASSET_CONFIG_TAB_ID ) ; Wait < WebDriver > fwait = new FluentWait < WebDriver > ( driver ) . withTimeout ( 60 , TimeUnit . SECONDS ) . pollingEvery ( 2 , TimeUnit . SECONDS ) . ignoring ( StaleElementReferenceException . class , NoSuchElementException . class ) ; fwait . until ( new ExpectedCondition < Boolean > ( ) { @ Override public Boolean apply ( WebDriver driver ) { final WebElement asset = retrieveAsset ( driver , assetName ) ; if ( asset != null ) { asset . findElement ( By . cssSelector ( "button[id$='removeButton']" ) ) . click ( ) ; return true ; } return false ; } } ) ; wait . until ( ExpectedConditions . visibilityOfElementLocated ( By . cssSelector ( "div[id$='confirmDialog']" ) ) ) ; driver . findElement ( By . cssSelector ( "button[id$='removeAsset']" ) ) . click ( ) ; fwait . until ( new ExpectedCondition < Boolean > ( ) { @ Override public Boolean apply ( WebDriver driver ) { return retrieveAsset ( driver , assetName ) == null ; } } ) ; }
Assuming an asset with the given name is already created and deactivated, remove the asset.
Assuming an asset with the given name is already created and deactivated remove the asset .
//Initial page/tab check. //Use a fluent wait to insure that the remove asset button actually gets clicked before continuing. //---remove the asset--- //confirm we want to remove the asset