Пример #1
0
 public static IControl GetColumnHeader(IControl titleRow, String headerText, TableColumnContentType contentType)
 {
     if (titleRow != null && titleRow.WebElement != null)
     {
         ReadOnlyCollection <IControl> headerCellList = SyncUtilities.FindElements_Parent(titleRow.WebElement, By.TagName("th"));
         foreach (IControl headerCell in headerCellList)
         {
             if (contentType == TableColumnContentType.Link)
             {
                 IControl headerCellLink = SyncUtilities.FindElement_Parent(headerCell.WebElement, By.TagName("a"));
                 if (headerCellLink.WebElement.Text.Equals(headerText, StringComparison.InvariantCultureIgnoreCase))
                 {
                     return(headerCellLink);
                 }
             }
             else
             {
                 if (headerCell.WebElement.Text.Trim().Equals(headerText.Trim(), StringComparison.InvariantCultureIgnoreCase))
                 {
                     return(headerCell);
                 }
             }
         }
     }
     return(null);
 }
 public WebTable_SearchCriteriaItem(int columnIndex, String value, TableColumnContentType columnContentType)
 {
     this.ColumnIndex = columnIndex;
     this.Value = value;
     this.ColumnContentType = columnContentType;
 }
Пример #3
0
        public static IControl GetElement(IControl tableRow, String linkText, int columnIndex, TableColumnContentType contentType)
        {
            ReadOnlyCollection <IWebElement> cells = tableRow.WebElement.FindElements(By.XPath("./td"));
            IWebElement cell = null;

            if (cells.Count > columnIndex)
            {
                cell = cells[columnIndex];
            }
            switch (contentType)
            {
            case TableColumnContentType.Image:
                return(SyncUtilities.FindElement_Parent(cell, By.TagName("img")));

            case TableColumnContentType.Link:
                return(SyncUtilities.FindElement_Parent(cell, By.LinkText(linkText)));

            case TableColumnContentType.Link_Partial:
                return(SyncUtilities.FindElement_Parent(cell, By.PartialLinkText(linkText)));

            case TableColumnContentType.Dropdown:
                IControl c = SyncUtilities.FindElement_Parent(cell, By.TagName("select"));
                return(new Control(c.WebElement, new SelectElement(c.WebElement)));

            case TableColumnContentType.CheckboxAndText:
            case TableColumnContentType.Textbox:
            case TableColumnContentType.Checkbox:
            case TableColumnContentType.RadioButton:
                return(SyncUtilities.FindElement_Parent(cell, By.TagName("input")));

            case TableColumnContentType.Span:
                return(SyncUtilities.FindElement_Parent(cell, By.TagName("span")));

            default:
                return(null);
            }
        }