Does anyone have code for interacting with celltables in selenim tests?

I have a selenium test and a CellTable that is filled with the results of 
an RPC call. The table displays a "loading" image until the rows are 
populated, and I need to wait for the "loaded" condition in my selenium 
test code. I notice that in the element tree there are two TBODY elements, 
a second one which is styled "display: none" when the table is loaded - 
this contains the loading image.

I am using an xpath expression to find the second TBODY: 
"//*[@id='gwt-debug-gameDetailsTable']/tbody[2]"
Here is the code I am using right now. Basically, if the table has already 
loaded prior to looking for the TBODY, everything is okay - isDIsplayed is 
false. But if it isn't, neither of these ExpectedConditions work, even 
though the first one only checks to see that it isn't displayed anymore. I 
am using HTMLUnit version 22 and selenium 2.53.1.

        WebElement tbody2 = driver.findElement(By.xpath("//*[@id='" + 
GWTID_GAMEDETAILSTABLE + "']/tbody[2]"));
        if(tbody2.isDisplayed())
        {
            try {
                logger.info("waiting for games table to load...");
                Boolean until = (new WebDriverWait(driver, 10)).until(new 
ExpectedCondition<Boolean>() {
                    @Nullable
                    @Override
                    public Boolean apply(@Nullable WebDriver input) {
                        return tbody2.isDisplayed() == false;
                    }
                });
                //Boolean until = (new WebDriverWait(driver, 
10)).until(ExpectedConditions.invisibilityOfElementLocated(By.xpath("//*[@id='" 
+ GWTID_GAMEDETAILSTABLE + "']/tbody[2]")));
                logger.info("until = {}", until);
            } catch(Exception ex)
            {
                logger.warn("{}", ex);
            }
        } else {
            logger.info("no need to wait for games table to load, 'loading' 
tbody is hidden");
        }



-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to