コード例 #1
0
ファイル: ControlGenerator.cs プロジェクト: teknologika/stax
        /// <summary>
        /// Retrieve the control contained in the supplied IEContainer
        /// </summary>
        /// <param name="IE">IEContainer</param>
        internal static void GenerateControl(IEDocument IE, ControlSelection selections, List<Control> validControls, List<Control> invalidControl)
        {
            Control tempControl = new Control();

            Cursor.Current = Cursors.WaitCursor;

            //Loop through all types of control supported by Watin and add the control to the appropriate control list

            AddControlsforDocument(IE, selections, validControls, invalidControl,"");

            if (IE.Frames.Count > 0)
            {
                foreach (var item in IE.Frames)
                {
                    AddControlsforDocument(item, selections, validControls, invalidControl,item.Id);
                }
            }

            Cursor.Current = Cursors.Default;
        }
コード例 #2
0
ファイル: ControlGenerator.cs プロジェクト: teknologika/stax
        private static void AddControlsforDocument(Document IE, ControlSelection selections, List<Control> validControls, List<Control> invalidControl, string frameName)
        {
            if (selections.TextField)
            {
                foreach (WatiN.Core.TextField textField in IE.TextFields)
                {
                    AddControlToList(textField, "txt", ControlType.text, validControls, invalidControl, frameName);
                }
            }

            if (selections.SelectList)
            {
                foreach (WatiN.Core.SelectList selectList in IE.SelectLists)
                {
                    AddControlToList(selectList, "ddl", ControlType.select, validControls, invalidControl, frameName);
                }
            }

            if (selections.CheckBox)
            {
                foreach (WatiN.Core.CheckBox checkBox in IE.CheckBoxes)
                {
                    AddControlToList(checkBox, "chk", ControlType.checkBox, validControls, invalidControl, frameName);
                }
            }

            if (selections.Div)
            {
                foreach (WatiN.Core.Div div in IE.Divs)
                {
                    AddControlToList(div, "div", ControlType.div, validControls, invalidControl, frameName);
                }
            }

            if (selections.Image)
            {
                foreach (WatiN.Core.Image image in IE.Images)
                {
                    AddControlToList(image, "img", ControlType.image, validControls, invalidControl, frameName);
                }
            }

            if (selections.Label)
            {
                foreach (WatiN.Core.Label label in IE.Labels)
                {
                    AddControlToList(label, "lbl", ControlType.label, validControls, invalidControl, frameName);
                }
            }

            if (selections.Link)
            {
                foreach (WatiN.Core.Link link in IE.Links)
                {
                    AddControlToList(link, "lnk", ControlType.link, validControls, invalidControl, frameName);
                }
            }

            if (selections.RadioButton)
            {
                foreach (WatiN.Core.RadioButton radioButton in IE.RadioButtons)
                {
                    AddControlToList(radioButton, "rdo", ControlType.radiobutton, validControls, invalidControl, frameName);
                }
            }

            if (selections.Span)
            {
                foreach (WatiN.Core.Span span in IE.Spans)
                {
                    AddControlToList(span, "span", ControlType.span, validControls, invalidControl, frameName);
                }
            }

            if (selections.Table)
            {
                foreach (WatiN.Core.Table table in IE.Tables)
                {
                    AddControlToList(table, "tbl", ControlType.table, validControls, invalidControl, frameName);
                }
            }

            if (selections.Button)
            {
                foreach (WatiN.Core.Button button in IE.Buttons)
                {
                    AddControlToList(button, "btn", ControlType.button, validControls, invalidControl, frameName);
                }
            }
        }