package org.zanata.page.groups;

import java.util.Collections;
import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.zanata.page.AbstractPage;
import org.zanata.util.TableRow;
import org.zanata.util.WebElementUtil;

/**
 * @author Patrick Huang <a href="mailto:pahuang@redhat.com">pahuang@redhat.com</a>
 */
public class VersionGroupsPage extends AbstractPage
{
   public static final int GROUP_NAME_COLUMN = 0;

   @FindBy(id = "main_body_content")
   private WebElement mainContentDiv;

   public VersionGroupsPage(WebDriver driver)
   {
      super(driver);
   }

   public List<String> getGroupNames()
   {
      if (mainContentDiv.getText().contains("No group exists"))
      {
         return Collections.emptyList();
      }

      By by = By.id("iterationGroupForm:iterationsDataTable");
      return WebElementUtil.getColumnContents(getDriver(), by, GROUP_NAME_COLUMN);
   }

   public CreateVersionGroupPage createNewGroup()
   {
      WebElement createLink = getDriver().findElement(By.linkText("Create New Group"));
      createLink.click();
      return new CreateVersionGroupPage(getDriver());
   }

   public VersionGroupPage goToGroup(String groupName)
   {
      WebElement groupLink = mainContentDiv.findElement(By.linkText(groupName));
      groupLink.click();
      return new VersionGroupPage(getDriver());
   }
}

@@ -559,25 +559,28 @@
  = %22
-main_body_content
+groupForm:groupTable
 %22)%0A 
@@ -600,30 +600,26 @@
 Element 
-mainContentDiv
+groupTable
 ;%0A%0A   pu
@@ -745,178 +745,38 @@
     
-if (mainContentDiv.getText().contains(%22No group exists%22))%0A      %7B%0A         return Collections.emptyList();%0A      %7D%0A%0A      By by = By.id(%22iterationGroupForm:iterationsData
+By by = By.id(%22groupForm:group
 Tabl
@@ -1191,22 +1191,18 @@
 k = 
-mainContentDiv
+groupTable
 .fin

fix page object