Ejemplo n.º 1
0
        public static IControl Table_FindRow(IControl webTable, WebTable_SearchCriteriaItemList searchCreteriaItemList, int startRowIndex = 0)
        {
            IControl tableBody;

            if (webTable != null && webTable.WebElement != null)
            {
                if (webTable.WebElement.TagName == "tbody")
                {
                    tableBody = webTable;
                }
                else
                {
                    tableBody = SyncUtilities.FindElement_Parent(webTable.WebElement, By.XPath("./tbody"));
                }
                ReadOnlyCollection <IControl> rows = SyncUtilities.FindElements_Parent(tableBody.WebElement, By.TagName("tr"));
                for (int rowIndex = 0; rowIndex < rows.Count; ++rowIndex)
                {
                    IControl row = rows[rowIndex];
                    if (rowIndex >= startRowIndex)
                    {
                        if (HasRowContainsSearchContent(row.WebElement, searchCreteriaItemList))
                        {
                            return(row);
                        }
                    }
                }
            }
            return(null);
        }
        public static IControl GetCollapsedTableRow(String tableName, int rowNumber)
        {
            IControl tableNameHost = null;
            IControl tableHost     = GetTableHost(tableName, rowNumber, out tableNameHost);
            IReadOnlyCollection <IControl> rows = SyncUtilities.FindElements_Parent(tableHost.WebElement, By.ClassName("HeaderRowOff"));

            foreach (IControl row in rows)
            {
                IReadOnlyCollection <IControl> cells = SyncUtilities.FindElements_Parent(row.WebElement, By.ClassName("tdCollapseRowNum"));
                foreach (IControl cell in cells)
                {
                    String cellText = Control_PropertyUtilities.GetText(cell);
                    if (cellText.EndsWith("." + rowNumber + "."))
                    {
                        if (Control_ActionUtilities.IsClickable(row.WebElement))
                        {
                            return(row);
                        }
                        else
                        {
                            return(null);
                        }
                    }
                }
            }
            return(null);
        }
 public static bool IsTableHistoryIconAvailable_WithoutWait(String tableName)
 {
     try
     {
         IControl tableNameHost = null;
         IControl tableHost     = GetTableHost(tableName, 0, out tableNameHost);
         if (tableHost != null && tableNameHost != null && tableNameHost.WebElement != null)
         {
             ReadOnlyCollection <IControl> images = SyncUtilities.FindElements_Parent(tableNameHost.WebElement, By.TagName("img"));
             foreach (IControl image in images)
             {
                 bool   found    = false;
                 String imageSrc = Control_PropertyUtilities.GetAttributeValue(image, "src", out found);
                 if (found && imageSrc.EndsWith("changeHistory.gif"))
                 {
                     return(true);
                 }
             }
         }
     }
     catch (Exception e)
     {
     }
     return(false);
 }
Ejemplo n.º 4
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);
 }
Ejemplo n.º 5
0
        public static ReadOnlyCollection <IControl> GetRowsEventRows(String identifier)
        {
            identifier = identifier.Replace("Events", "Forms");
            String cssSelector = "tr[identifier='" + identifier + "']";

            return(SyncUtilities.FindElements_Parent(EventsTable.WebElement, By.CssSelector(cssSelector)));
        }
        static IControl GetGroupsTable()
        {
            IControl mainPanel = SyncUtilities.FindElement(By.Id("mainContent"));
            IControl mainTable = SyncUtilities.FindElement_Parent(mainPanel.WebElement, By.Id("tblMainContent"));
            ReadOnlyCollection <IControl> tableList = SyncUtilities.FindElements_Parent(mainTable.WebElement, By.TagName("table"));

            return(new Control(tableList[0].WebElement));
        }
Ejemplo n.º 7
0
        public static System.Collections.ObjectModel.ReadOnlyCollection <IControl> GetDropdownItems()
        {
            String   dropdonwItemsHostCSSSelector = ".k-animation-container ul";
            IControl host = SyncUtilities.FindVisibleElement(By.CssSelector(dropdonwItemsHostCSSSelector));

            if (!Control_PropertyUtilities.IsControlNull(host))
            {
                return(SyncUtilities.FindElements_Parent(host.WebElement, By.TagName("li")));
            }
            return(null);
        }
Ejemplo n.º 8
0
        public static IControl GetRowByRowIndex(IControl webTable, int rowIndex)
        {
            IControl tableBody = SyncUtilities.FindElement_Parent(webTable.WebElement, By.TagName("tbody"));
            ReadOnlyCollection <IControl> rows = SyncUtilities.FindElements_Parent(tableBody.WebElement, By.TagName("tr"));

            if (rows.Count > rowIndex)
            {
                return(rows[rowIndex]);
            }
            return(null);
        }
 static IControl GetFilterCell(IControl filterRow, int columnIndex)
 {
     if (filterRow != null && filterRow.WebElement != null)
     {
         ReadOnlyCollection<IControl> filterCellList = SyncUtilities.FindElements_Parent(filterRow.WebElement, By.TagName("th"));
         if (columnIndex < filterCellList.Count)
         {
             return filterCellList[columnIndex];
         }
     }
     return null;
 }
        static IControl GetCellStatus(IControl row, String permissionType, out PermissionStatus permissionStatus)//,out bool found)
        {
            permissionStatus = PermissionStatus.None;
            //found = false;
            IControl c    = null;
            IControl cell = null;
            ReadOnlyCollection <IControl> cells = SyncUtilities.FindElements_Parent(row.WebElement, By.TagName("td"));

            if (permissionType.Equals("Allow", StringComparison.InvariantCultureIgnoreCase))
            {
                cell = cells[2];
            }
            else if (permissionType.Equals("Deny", StringComparison.InvariantCultureIgnoreCase))
            {
                cell = cells[3];
            }
            else if (permissionType.Equals("Hide", StringComparison.InvariantCultureIgnoreCase))
            {
                cell = cells[4];
            }
            else if (permissionType.Equals("View", StringComparison.InvariantCultureIgnoreCase))
            {
                cell = cells[5];
            }
            else if (permissionType.Equals("Edit", StringComparison.InvariantCultureIgnoreCase))
            {
                cell = cells[6];
            }

            if (cell != null)
            {
                c = SyncUtilities.FindElement_Parent(cell.WebElement, By.TagName("input"));
                if (c.WebElement != null)
                {
                    //found = true;
                    Boolean propStatus = c.WebElement.Enabled;
                    if (!propStatus)
                    {
                        permissionStatus = PermissionStatus.Disabled;
                    }
                    else if (propStatus)
                    {
                        permissionStatus = PermissionStatus.Enabled;
                    }
                }
                else
                {
                    permissionStatus = PermissionStatus.None;
                }
            }
            return(c);
        }
        static IControl GetCell(IControl row, String permissionType, out PermissionValue permissionValue)//,out bool found)
        {
            permissionValue = PermissionValue.None;
            //found = false;
            IControl c    = null;
            IControl cell = null;
            ReadOnlyCollection <IControl> cells = SyncUtilities.FindElements_Parent(row.WebElement, By.TagName("td"));

            if (permissionType.Equals("Allow", StringComparison.InvariantCultureIgnoreCase))
            {
                cell = cells[2];
            }
            else if (permissionType.Equals("Deny", StringComparison.InvariantCultureIgnoreCase))
            {
                cell = cells[3];
            }
            else if (permissionType.Equals("Hide", StringComparison.InvariantCultureIgnoreCase))
            {
                cell = cells[4];
            }
            else if (permissionType.Equals("View", StringComparison.InvariantCultureIgnoreCase))
            {
                cell = cells[5];
            }
            else if (permissionType.Equals("Edit", StringComparison.InvariantCultureIgnoreCase))
            {
                cell = cells[6];
            }

            if (cell != null)
            {
                c = SyncUtilities.FindElement_Parent(cell.WebElement, By.TagName("input"));
                if (c.WebElement != null)
                {
                    //found = true;
                    String propValue = c.WebElement.GetAttribute("checked");
                    if (String.IsNullOrEmpty(propValue))
                    {
                        permissionValue = PermissionValue.False;
                    }
                    else if (propValue.Equals("true", StringComparison.InvariantCultureIgnoreCase))
                    {
                        permissionValue = PermissionValue.True;
                    }
                }
                else
                {
                    permissionValue = PermissionValue.None;
                }
            }
            return(c);
        }
Ejemplo n.º 12
0
        public static IControl GetDataCell(String data)
        {
            ReadOnlyCollection <IControl> dataCells = SyncUtilities.FindElements_Parent(LabInfoTable.WebElement, By.TagName("td"));

            foreach (IControl dataCell in dataCells)
            {
                String cellText = Control_PropertyUtilities.GetText(dataCell);
                if (data.Trim().Equals(cellText, StringComparison.InvariantCultureIgnoreCase))
                {
                    return(dataCell);
                }
            }
            return(null);
        }
Ejemplo n.º 13
0
        public static IControl CodeListMappingButtonForField(String field)
        {
            IControl EditButton = null;

            foreach (IWebElement row in AttributeMappingTableRows)
            {
                if (row.Text.Contains(field))
                {
                    ReadOnlyCollection <IControl> cells = SyncUtilities.FindElements_Parent(row, By.TagName("td"));
                    EditButton = cells[2];
                }
            }
            return(GetCodelistMappingButton(EditButton));
        }
        protected static IControl GetFlatQuestionHost(String questionPrompt)
        {
            IControl crfTabContent             = SyncUtilities.FindVisibleElement(By.Id("divCRFTab"));
            ReadOnlyCollection <IControl> rows = SyncUtilities.FindElements_Parent(crfTabContent.WebElement, By.CssSelector("span > table > tbody > tr"));

            foreach (IControl row in rows)
            {
                ReadOnlyCollection <IControl> questionParts = SyncUtilities.FindElements_Parent(row.WebElement, By.CssSelector("td > .table100pct td"));
                if (IsQuestionPromptAvailable(questionParts, questionPrompt))
                {
                    return(row);
                }
            }
            return(null);
        }
Ejemplo n.º 15
0
        public static List <String> GetValuesInColumn(IControl webTable, int colIndex)
        {
            List <String> list = new List <String>();
            ReadOnlyCollection <IControl> rows = null;

            GetRowCount(webTable, out rows);
            foreach (IControl row in rows)
            {
                ReadOnlyCollection <IControl> cellList = SyncUtilities.FindElements_Parent(row.WebElement, By.TagName("td"));
                if (colIndex < cellList.Count)
                {
                    IControl cell = cellList[colIndex];
                    list.Add(cell.WebElement.Text);
                }
            }
            return(list);
        }
        public static IControl derivationNameLink(string derivationName)
        {
            // ReadOnlyCollection<IControl> derivationNamerows = WebTableUtilities.GetRows(DL_DerivationManagement.derivationListTable);
            ReadOnlyCollection <IControl> derivationNamerows = SyncUtilities.FindElements_Parent(DL_DerivationManagement.derivationListTable.WebElement, By.TagName("tr"));

            foreach (IControl row in derivationNamerows)
            {
                IControl derivationNameLink = SyncUtilities.FindVisibleElement_Parent(row.WebElement, By.TagName("a"));
                string   linkText           = Control_PropertyUtilities.GetText(derivationNameLink);

                if (derivationName.Equals(linkText, StringComparison.InvariantCultureIgnoreCase))
                {
                    return(derivationNameLink);
                }
            }
            return(null);
        }
Ejemplo n.º 17
0
        public static ReadOnlyCollection <IControl> GetAvailableCodelistDropdownItems()
        {
            try
            {
                String   dropdonwItemsHostCSSSelector = "#ctl00_ContentBody_RadListBoxSource > div.rlbTemplate > div > div.rlbBody > div > ul";
                IControl host = SyncUtilities.FindVisibleElement(By.CssSelector(dropdonwItemsHostCSSSelector));
                if (!Control_PropertyUtilities.IsControlNull(host))
                {
                    return(SyncUtilities.FindElements_Parent(host.WebElement, By.TagName("li")));
                }
            }
            catch (Exception e)
            {
                new DebugLogGenerator().WriteException(MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, e);
            }

            return(null);
        }
        protected static IControl GetTableQuestionHost(String tableName, String questionPrompt)
        {
            IControl tableNameHost = null;
            IControl tableHost     = GetTableHost(tableName, 0, out tableNameHost);

            if (tableHost != null && tableHost.WebElement != null)
            {
                ReadOnlyCollection <IControl> tableQuestionHostList = SyncUtilities.FindElements_Parent(tableHost.WebElement, By.ClassName("table100pct"));
                foreach (IControl questionHost in tableQuestionHostList)
                {
                    ReadOnlyCollection <IControl> questionParts = SyncUtilities.FindElements_Parent(questionHost.WebElement, By.CssSelector("td"));
                    if (IsQuestionPromptAvailable(questionParts, questionPrompt))
                    {
                        return(questionHost);
                    }
                }
            }
            return(null);
        }
Ejemplo n.º 19
0
        public static IControl GetRow(IControl webTable, int rowIndex)
        {
            IControl tableBody;

            if (webTable != null && webTable.WebElement != null)
            {
                if (webTable.WebElement.TagName == "tbody")
                {
                    tableBody = webTable;
                }
                else
                {
                    tableBody = SyncUtilities.FindElement_Parent(webTable.WebElement, By.XPath("./tbody"));
                }
                ReadOnlyCollection <IControl> rows = SyncUtilities.FindElements_Parent(tableBody.WebElement, By.XPath("./tr"));
                if (rows.Count > rowIndex)
                {
                    return(rows[rowIndex]);
                }
            }
            return(null);
        }
        public static IControl GetExpandCollapseImage_CategoryRow(String category, out bool isExpanded)
        {
            IControl image = null;

            isExpanded = false;
            bool     hasCategory = false;
            IControl categoryRow = GetPermissionsCategoryRow(category, out hasCategory);

            if (hasCategory && categoryRow.WebElement != null)
            {
                ReadOnlyCollection <IControl> cells = SyncUtilities.FindElements_Parent(categoryRow.WebElement, By.TagName("td"));
                if (cells.Count > 0)
                {
                    IControl expandCollapseCell = cells[0];
                    image = SyncUtilities.FindElement_Parent(expandCollapseCell.WebElement, By.TagName("img"));
                    if (image.WebElement != null)
                    {
                        String propertyValue = image.WebElement.GetAttribute("src");
                        isExpanded = propertyValue.Contains("collapse");
                    }
                }
            }
            return(image);
        }
Ejemplo n.º 21
0
        public static ReadOnlyCollection <IControl> GetRows(IControl webTable)
        {
            IControl tableBody = SyncUtilities.FindElement_Parent(webTable.WebElement, By.TagName("tbody"));

            return(SyncUtilities.FindElements_Parent(tableBody.WebElement, By.TagName("tr")));
        }
 public static ReadOnlyCollection <IControl> GetStrikeCells(IControl tableRow)
 {
     return(SyncUtilities.FindElements_Parent(tableRow.WebElement, By.TagName("strike")));
 }