Example #1
0
 public WatFrame(WatinBaseControl parent, WatiN.Core.Frame element, int idx)
 {
     _parent = parent;
     if (element != null)
     {
         docElement = element;
         // docElement
         _index = idx;
     }
 }
Example #2
0
        public static void SelectRadioButtonByName(Frame frame, string controlName, string selectedValue)
        {
            RadioButtonCollection rbCollection = frame.RadioButtons.Filter(Find.ByName(s => s.Contains(controlName)));

            foreach (RadioButton rb in rbCollection)
            {
                if (selectedValue != rb.GetAttributeValue("value")) continue;
                rb.Checked = true;
                break;
            }
        }
Example #3
0
	    /// <summary>
	    /// This constructor will mainly be used by the constructor of FrameCollection
	    /// to create an instance of a Frame.
	    /// </summary>
	    /// <param name="domContainer">The domContainer</param>
	    /// <param name="frameDocument">The document within the frame</param>
	    /// <param name="parentDocument"> </param>
	    public Frame(DomContainer domContainer, INativeDocument frameDocument, Frame parentDocument)
            : base(domContainer)
		{
	        if (frameDocument == null)
                throw new ArgumentNullException("frameDocument");

            _frameDocument = frameDocument;
            FrameElement = CreateFrameElement(domContainer, frameDocument);

            SetFrameHierarchy(parentDocument, frameDocument);
		}
Example #4
0
		public void Process(IWebBrowser2 webBrowser2)
		{
			// Get the frame element from the parent document
			IHTMLElement frameElement = (IHTMLElement) frameElements.item(index, null);
			string frameElementUniqueId = ((DispHTMLBaseElement) frameElement).uniqueID;

			Frame frame = new Frame(_domContainer, (IHTMLDocument2)webBrowser2.Document, (IHTMLDocument3) htmlDocument, frameElementUniqueId);
			
			elements.Add(frame);

			index++;
		}
Example #5
0
	    /// <summary>
	    /// This is done to facilitate CSS selector look up in IEElementCollection
	    /// </summary>
	    /// <param name="parentDocument"> </param>
	    /// <param name="frameDocument"> </param>
	    private void SetFrameHierarchy(Frame parentDocument, INativeDocument frameDocument)
	    {

            var nameOrId = GetFrameElementNameOrId(FrameElement);
	        var hierarchy = string.Empty;

            if (parentDocument != null)
            {
                var frameElement = parentDocument.FrameElement;
                hierarchy = frameElement.GetAttributeValue("data-watinFrameHierarchy") + ".";
            }

	        hierarchy = hierarchy + nameOrId;
	        
            FrameElement.SetAttributeValue("data-watinFrameHierarchy", hierarchy);
            frameDocument.RunScript(frameDocument.JavaScriptVariableName + ".___WATINFRAMEHIERARCHY = '" + hierarchy + "'", "javascript");
	    }
Example #6
0
 public WatiNFrame(Frame frame)
 {
     Native = frame;
 }
 public static object FindControlInFrameByID(Frame frame, string strID, Enumerators.ControlType ctrl)
 {
     if (ctrl == Enumerators.ControlType.Span)
     {
         Span sp = frame.Span(Find.ById(strID));
         Assert.IsTrue(sp.Exists, "Could not Find: " + strID);
         return sp;
     }
     else if (ctrl == Enumerators.ControlType.Link)
     {
         Link lnk = frame.Link(Find.ById(strID));
         Assert.IsTrue(lnk.Exists, "Could not Find: " + strID);
         return lnk;
     }
     else if (ctrl == Enumerators.ControlType.Image)
     {
         Image img = frame.Image(Find.BySrc(strID));
         Assert.IsTrue(img.Exists, "Could not Find: " + strID);
         return img;
     }
     else if (ctrl == Enumerators.ControlType.TableCell)
     {
         TableCell tCell = frame.TableCell(Find.ById(strID));
         Assert.IsTrue(tCell.Exists, "Could not Find: " + strID);
         return tCell;
     }
     else if (ctrl == Enumerators.ControlType.Table)
     {
         Table nestedTbl = frame.Table(Find.ById(strID));
         Assert.IsTrue(nestedTbl.Exists, "Could not Find: " + strID);
         return nestedTbl;
     }
     else if (ctrl == Enumerators.ControlType.CheckBox)
     {
         CheckBox chk = frame.CheckBox(Find.ById(strID));
         Assert.IsTrue(chk.Exists, "Could not Find: " + strID);
         return chk;
     }
     else if (ctrl == Enumerators.ControlType.Button)
     {
         Button btn = frame.Button(Find.ById(strID));
         Assert.IsTrue(btn.Exists, "Could not Find: " + strID);
         return btn;
     }
     else if (ctrl == Enumerators.ControlType.TextField)
     {
         TextField txt = frame.TextField(Find.ById(strID));
         Assert.IsTrue(txt.Exists, "Could not Find: " + strID);
         return txt;
     }
     else if (ctrl == Enumerators.ControlType.Div)
     {
         Div division = frame.Div(Find.ById(strID));
         Assert.IsTrue(division.Exists, "Could not Find: " + strID);
         return division;
     }
     else if (ctrl == Enumerators.ControlType.TableRow)
     {
         TableRow tRow = frame.TableRow(Find.ById(strID));
         Assert.IsTrue(tRow.Exists, "Could not Find: " + strID);
         return tRow;
     }
     else
     {
         return null;
     }
 }
Example #8
0
 public cFrame(Frame baseObject)
     : base(baseObject)
 {
     obj = baseObject;
 }