Beispiel #1
0
 public WebControl(Browser aBrowser,Locator aLocator)
 {
     myControlAccess = new ControlAccess();
     myControlAccess.Browser = aBrowser;
     myControlAccess.LocatorType = aLocator.LocatorType;
     myControlAccess.Locator = aLocator.ControlLocator;
     myControlAccess.ControlType = ControlType.Custom;
     myControlAccess.IntializeControlAccess();
     //Control = myControlAccess.GetControl();
 }
Beispiel #2
0
 public WebControl(Browser aBrowser,LocatorType aLocatorType,string aLocator,ControlType aControlType)
 {
     myControlAccess = new ControlAccess();
     myControlAccess.Browser = aBrowser;
     myControlAccess.LocatorType = aLocatorType;
     myControlAccess.Locator = aLocator;
     myControlAccess.ControlType = aControlType;
     myControlAccess.IntializeControlAccess();
     //Control = myControlAccess.GetControl();
 }
Beispiel #3
0
        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 #4
0
        internal static List<WebControl> GetWebControlsFromIControlList(List<IControl> aIControlList, Browser aBrowser, Locator aLocator,ControlType aConrolType)
        {
            List<WebControl> aWebControlList = new List<WebControl>();

            foreach (IControl aControl in aIControlList)
            {
                aWebControlList.Add(GetWebControlFromIContol(aControl, aBrowser, aLocator, aConrolType));               
            }

            return aWebControlList;
        }
Beispiel #5
0
 public WebPage(Browser aBrowser, Locator aLocator)
     : base(aBrowser, aLocator.LocatorType, aLocator.ControlLocator, ControlType.Page)
 { }
Beispiel #6
0
 public WebSpanArea(Browser aBrowser, Locator aLocator)
     : base(aBrowser, aLocator.LocatorType, aLocator.ControlLocator, ControlType.SpanArea)
 { }
Beispiel #7
0
 public WebCalender(Browser aBrowser, Locator aLocator)
     : base(aBrowser, aLocator.LocatorType, aLocator.ControlLocator, ControlType.Calender)
 {
     browser = aBrowser;
     locator = aLocator;
 }
Beispiel #8
0
 public WebRow(Browser aBrowser, Locator aLocator)
     : base(aBrowser, aLocator.LocatorType, aLocator.ControlLocator, ControlType.WebRow)
 {
     browser = aBrowser;
     locator = aLocator;
 }
Beispiel #9
0
  public WebCell(Browser aBrowser, Locator aLocator)
     : base(aBrowser, aLocator.LocatorType, aLocator.ControlLocator, ControlType.WebCell)
 { }
        public object InjectJSInBrowser(Browser aBrowser, string JavaScript)
        {
            IJavaScriptExecutor aScriptExecutor = (IJavaScriptExecutor)aBrowser.BrowserHandle;

            return aScriptExecutor.ExecuteScript(JavaScript);
        }
        public object ExecuteJavaScript(Browser aBrowser, string JavaScript)
        {
            IJavaScriptExecutor aScriptExecutor = (IJavaScriptExecutor)aBrowser.BrowserHandle;

            return aScriptExecutor.ExecuteScript(JavaScript, aWebElement);

        }
        public void Highlight(Browser aBrowser)
        {
            IJavaScriptExecutor aScriptExecutor = (IJavaScriptExecutor)aBrowser.BrowserHandle;

            object aStyle = aScriptExecutor.ExecuteScript("arguments[0].getAttribute('style');", aWebElement);
            aScriptExecutor.ExecuteScript("arguments[0].setAttribute('style', arguments[1]);", aWebElement,
                                          "border: 4px solid red;");

            //for (int i = 0; i < 5; i++)
            //{
            //    //aScriptExecutor.ExecuteScript("arguments[0].setAttribute('style', arguments[1]);", aWebElement,"color: red; border: 4px solid red;");

            //    object aStyle = aScriptExecutor.ExecuteScript("arguments[0].getAttribute('style');", aWebElement);
            //    aScriptExecutor.ExecuteScript("arguments[0].setAttribute('style', arguments[1]);", aWebElement,
            //                                  "border: 4px solid red;");
            //    //Thread.Sleep(50);

            //    //aScriptExecutor.ExecuteScript("arguments[0].setAttribute('style', arguments[1]);",
            //    //    aWebElement, aStyle);
            //}
        }
 public string InnerHtml(Browser aBrowser)
 {
     return (string)ExecuteJavaScript(aBrowser, @"return arguments[0].innerHTML;");
 }
Beispiel #14
0
 public WebLink(Browser aBrowser, Locator aLocator)
     : base(aBrowser, aLocator.LocatorType, aLocator.ControlLocator, ControlType.Link)
 { }
Beispiel #15
0
 public WebButton(Browser aBrowser, Locator aLocator)
     :base(aBrowser,aLocator.LocatorType,aLocator.ControlLocator,ControlType.Button)
 { }
Beispiel #16
0
 public WebEditBox(Browser aBrowser, Locator aLocator)
     : base(aBrowser, aLocator.LocatorType,aLocator.ControlLocator, ControlType.EditBox)
 { }
Beispiel #17
0
 public WebDialog(Browser aBrowser, Locator aLocator)
     : base(aBrowser, aLocator.LocatorType, aLocator.ControlLocator, ControlType.Dialog)
 { }
Beispiel #18
0
 public Actions(Browser browser, SeleniumWebControls control)
 {
     WebDriver = browser.BrowserHandle;
     WebElement = control.aWebElement;
 }
Beispiel #19
0
 public WebWebTable(Browser aBrowser, Locator aLocator)
     : base(aBrowser, aLocator.LocatorType, aLocator.ControlLocator, ControlType.WebTable)
 { }
Beispiel #20
0
 public WebFrame(Browser aBrowser, Locator aLocator)
     : base(aBrowser, aLocator.LocatorType, aLocator.ControlLocator, ControlType.Frame)
 { }
Beispiel #21
0
 public WebLabel(Browser aBrowser, Locator aLocator)
     : base(aBrowser, aLocator.LocatorType, aLocator.ControlLocator, ControlType.Label)
 { }