Пример #1
0
        public HtmlCheckBox GetEmbeddedCheckBox(int iRow, int iCol)
        {
            string       sSearchProperties = "";
            IHTMLElement td         = (IHTMLElement)GetCell(iRow, iCol).UnWrap().NativeElement;
            IHTMLElement check      = GetEmbeddedCheckBoxNativeElement(td);
            string       sOuterHTML = check.outerHTML.Replace("<", "").Replace(">", "").Trim();

            string[] saTemp = sOuterHTML.Split(' ');
            var      chk    = new CUITControls.HtmlCheckBox(SourceControl.Container);

            foreach (string sTemp in saTemp)
            {
                if (sTemp.IndexOf('=') > 0)
                {
                    string[] saKeyValue = sTemp.Split('=');
                    string   sValue     = saKeyValue[1];
                    if (saKeyValue[0].ToLower() == "name")
                    {
                        sSearchProperties += ";Name=" + sValue;
                        chk.SearchProperties.Add(UITestControl.PropertyNames.Name, sValue);
                    }
                    if (saKeyValue[0].ToLower() == "id")
                    {
                        sSearchProperties += ";Id=" + sValue;
                        chk.SearchProperties.Add(CUITControls.HtmlControl.PropertyNames.Id, sValue);
                    }
                    if (saKeyValue[0].ToLower() == "class")
                    {
                        sSearchProperties += ";Class=" + sValue;
                        chk.SearchProperties.Add(CUITControls.HtmlControl.PropertyNames.Class, sValue);
                    }
                }
            }

            if (sSearchProperties.Length > 1)
            {
                sSearchProperties = sSearchProperties.Substring(1);
            }
            HtmlCheckBox retChk = new HtmlCheckBox(sSearchProperties);

            retChk.Wrap(chk);
            return(retChk);
        }
Пример #2
0
        /// <summary>
        /// Gets the embedded check box at specified <paramref name="rowIndex"/> and
        /// <paramref name="columnIndex"/>.
        /// </summary>
        /// <param name="rowIndex">Index of the row.</param>
        /// <param name="columnIndex">Index of the column.</param>
        /// <returns></returns>
        public HtmlCheckBox GetEmbeddedCheckBox(int rowIndex, int columnIndex)
        {
            string       sSearchProperties = "";
            var          td        = (IHTMLElement)GetCell(rowIndex, columnIndex).SourceControl.NativeElement;
            IHTMLElement check     = GetEmbeddedCheckBoxNativeElement(td);
            string       outerHtml = check.outerHTML.Replace("<", "").Replace(">", "").Trim();

            string[] saTemp = outerHtml.Split(' ');
            var      chk    = new CUITControls.HtmlCheckBox(SourceControl.Container);

            foreach (string sTemp in saTemp)
            {
                if (sTemp.IndexOf('=') > 0)
                {
                    string[] saKeyValue = sTemp.Split('=');
                    string   sValue     = saKeyValue[1];
                    if (saKeyValue[0].ToLower() == "name")
                    {
                        sSearchProperties += ";Name=" + sValue;
                        chk.SearchProperties.Add(UITestControl.PropertyNames.Name, sValue);
                    }
                    if (saKeyValue[0].ToLower() == "id")
                    {
                        sSearchProperties += ";Id=" + sValue;
                        chk.SearchProperties.Add(CUITControls.HtmlControl.PropertyNames.Id, sValue);
                    }
                    if (saKeyValue[0].ToLower() == "class")
                    {
                        sSearchProperties += ";Class=" + sValue;
                        chk.SearchProperties.Add(CUITControls.HtmlControl.PropertyNames.Class, sValue);
                    }
                }
            }

            if (sSearchProperties.Length > 1)
            {
                sSearchProperties = sSearchProperties.Substring(1);
            }

            return(new HtmlCheckBox(chk, By.SearchProperties(sSearchProperties)));
        }