Inheritance: WebControl
Beispiel #1
0
        public WebControl GetControl(Locator aLocator, ControlType aControlType)
        {
            WebControl aWebCustomControl;

            switch (aControlType)
            {
            case ControlType.Button:
                aWebCustomControl = new WebButton(myBrowser, aLocator);
                break;

            case ControlType.EditBox:
                aWebCustomControl = new WebEditBox(myBrowser, aLocator);
                break;

            default:
                aWebCustomControl = new WebControl(myBrowser, aLocator);
                break;
            }

            if (aWebCustomControl.IsControlPresent())
            {
                aWebCustomControl.GetControl();
            }

            return(aWebCustomControl);
        }
        internal static WebControl GetWebControlFromIContol(IControl aControl, Browser aBrowser, Locator aLocator, ControlType aConrolType)
        {
            WebControl aWebControl = null;

            if (aConrolType == ControlType.Button)
            {
                WebButton aWebButton = new WebButton(aBrowser, aLocator);
                aWebButton.Control = aControl;
                aWebControl        = aWebButton;
            }

            if (aConrolType == ControlType.EditBox)
            {
                WebEditBox aWebEditBox = new WebEditBox(aBrowser, aLocator);
                aWebEditBox.Control = aControl;
                aWebControl         = aWebEditBox;
            }

            if (aConrolType == ControlType.Custom)
            {
                aWebControl         = new WebControl(aBrowser, aLocator);
                aWebControl.Control = aControl;
                //aWebControl = aWebEditBox;
            }
            if (aConrolType == ControlType.Calender)
            {
                WebCalender aWebCalender = new WebCalender(aBrowser, aLocator);
                aWebCalender.Control = aControl;
                aWebControl          = aWebCalender;
            }

            if (aConrolType == ControlType.ComboBox)
            {
                WebComboBox aWebComboBox = new WebComboBox(aBrowser, aLocator);
                aWebComboBox.Control = aControl;
                aWebControl          = aWebComboBox;
            }

            if (aConrolType == ControlType.CheckBox)
            {
                WebCheckBox aWebCheckBox = new WebCheckBox(aBrowser, aLocator);
                aWebCheckBox.Control = aControl;
                aWebControl          = aWebCheckBox;
            }

            if (aConrolType == ControlType.Dialog)
            {
                WebDialog aWebDialog = new WebDialog(aBrowser, aLocator);
                aWebDialog.Control = aControl;
                aWebControl        = aWebDialog;
            }

            if (aConrolType == ControlType.Frame)
            {
                WebFrame aWebFrame = new WebFrame(aBrowser, aLocator);
                aWebFrame.Control = aControl;
                aWebControl       = aWebFrame;
            }

            if (aConrolType == ControlType.Image)
            {
                WebImage aWebImage = new WebImage(aBrowser, aLocator);
                aWebImage.Control = aControl;
                aWebControl       = aWebImage;
            }

            if (aConrolType == ControlType.Label)
            {
                WebLabel aWebLabel = new WebLabel(aBrowser, aLocator);
                aWebLabel.Control = aControl;
                aWebControl       = aWebLabel;
            }

            if (aConrolType == ControlType.Link)
            {
                WebLink aWebLink = new WebLink(aBrowser, aLocator);
                aWebLink.Control = aControl;
                aWebControl      = aWebLink;
            }

            if (aConrolType == ControlType.ListBox)
            {
                WebListBox aWebListBox = new WebListBox(aBrowser, aLocator);
                aWebListBox.Control = aControl;
                aWebControl         = aWebListBox;
            }

            if (aConrolType == ControlType.Page)
            {
                WebPage aWebPage = new WebPage(aBrowser, aLocator);
                aWebPage.Control = aControl;
                aWebControl      = aWebPage;
            }

            if (aConrolType == ControlType.RadioButton)
            {
                WebRadioButton aWebRadioButton = new WebRadioButton(aBrowser, aLocator);
                aWebRadioButton.Control = aControl;
                aWebControl             = aWebRadioButton;
            }

            if (aConrolType == ControlType.SpanArea)
            {
                WebSpanArea aWebSpanArea = new WebSpanArea(aBrowser, aLocator);
                aWebSpanArea.Control = aControl;
                aWebControl          = aWebSpanArea;
            }

            if (aConrolType == ControlType.WebTable)
            {
                WebTable aWebTable = new WebTable(aBrowser, aLocator);
                aWebTable.Control = aControl;
                aWebControl       = aWebTable;
            }

            if (aConrolType == ControlType.WebRow)
            {
                WebRow aWebRow = new WebRow(aBrowser, aLocator);
                aWebRow.Control = aControl;
                aWebControl     = aWebRow;
            }

            if (aConrolType == ControlType.WebCell)
            {
                WebCell aWebCell = new WebCell(aBrowser, aLocator);
                aWebCell.Control = aControl;
                aWebControl      = aWebCell;
            }


            return(aWebControl);
        }
Beispiel #3
0
        private T GetControlFromLocator <T>(Locator aLocator) where T : WebControl
        {
            WebControl aWebCustomControl = null;

            if (typeof(T) == typeof(WebButton))
            {
                aWebCustomControl = new WebButton(myBrowser, aLocator);
            }

            if (typeof(T) == typeof(WebEditBox))
            {
                aWebCustomControl = new WebEditBox(myBrowser, aLocator);
            }

            if (typeof(T) == typeof(WebCalender))
            {
                aWebCustomControl = new WebCalender(myBrowser, aLocator);
            }

            if (typeof(T) == typeof(WebCheckBox))
            {
                aWebCustomControl = new WebCheckBox(myBrowser, aLocator);
            }

            if (typeof(T) == typeof(WebComboBox))
            {
                aWebCustomControl = new WebComboBox(myBrowser, aLocator);
            }

            if (typeof(T) == typeof(WebDialog))
            {
                aWebCustomControl = new WebDialog(myBrowser, aLocator);
            }

            if (typeof(T) == typeof(WebFrame))
            {
                aWebCustomControl = new WebFrame(myBrowser, aLocator);
            }

            if (typeof(T) == typeof(WebImage))
            {
                aWebCustomControl = new WebImage(myBrowser, aLocator);
            }

            if (typeof(T) == typeof(WebLabel))
            {
                aWebCustomControl = new WebLabel(myBrowser, aLocator);
            }

            if (typeof(T) == typeof(WebLink))
            {
                aWebCustomControl = new WebLink(myBrowser, aLocator);
            }

            if (typeof(T) == typeof(WebListBox))
            {
                aWebCustomControl = new WebListBox(myBrowser, aLocator);
            }

            if (typeof(T) == typeof(WebPage))
            {
                aWebCustomControl = new WebPage(myBrowser, aLocator);
            }

            if (typeof(T) == typeof(WebRadioButton))
            {
                aWebCustomControl = new WebRadioButton(myBrowser, aLocator);
            }

            if (typeof(T) == typeof(WebSpanArea))
            {
                aWebCustomControl = new WebSpanArea(myBrowser, aLocator);
            }

            if (typeof(T) == typeof(WebTable))
            {
                aWebCustomControl = new WebTable(myBrowser, aLocator);
            }

            if (typeof(T) == typeof(WebControl))
            {
                aWebCustomControl = new WebControl(myBrowser, aLocator);
            }

            if (null == aWebCustomControl)
            {
                aWebCustomControl = new WebControl(myBrowser, aLocator);
            }

            if (aWebCustomControl.IsControlPresent())
            {
                aWebCustomControl.GetControl();
            }

            return((T)aWebCustomControl);
        }