public static Element GetDefaultReturnElement(DomContainer domContainer, INativeElement ieNativeElement) { #if NET11 return new ElementsContainer(domContainer, ieNativeElement); #else return new ElementsContainer<Element>(domContainer, ieNativeElement); #endif }
private static string getInputType(INativeElement ieNativeElement) { if(IsAnInputElement(ieNativeElement.TagName)) { return ieNativeElement.GetAttributeValue("type"); } return null; }
public static Element CreateTypedElement(DomContainer domContainer, INativeElement ieNativeElement) { if (ieNativeElement == null) return null; if (_elementConstructors == null) { _elementConstructors = CreateElementConstructorHashTable(); } ElementTag elementTag = new ElementTag(ieNativeElement); Element returnElement = GetDefaultReturnElement(domContainer, ieNativeElement); if (_elementConstructors.Contains(elementTag)) { ConstructorInfo constructorInfo = (ConstructorInfo)_elementConstructors[elementTag]; return (Element)constructorInfo.Invoke(new object[] { returnElement }); } return returnElement; }
public bool Compare(INativeElement nativeElement) { if (nativeElement == null) return false; if (CompareTagName(nativeElement)) { if (IsInputElement) { return CompareInputTypes(nativeElement); } return true; } return false; }
/// <summary> /// Initializes a new instance of the <see cref="Div"/> class. /// Mainly used by WatiN internally. /// </summary> /// <param name="domContainer">The DOM container.</param> /// <param name="htmlDivElement">The HTML div element.</param> public Div(DomContainer domContainer, INativeElement htmlDivElement) : base(domContainer, htmlDivElement) { }
public RadioCheck(DomContainer domContainer, INativeElement element) : base(domContainer, element) { }
protected BaseNativeElement(INativeElement inner) { _inner = inner; }
/// <summary> /// Initializes a new instance of the <see cref="Style"/> class. /// </summary> /// <param name="nativeElement">The underlying <see cref="INativeElement"/>.</param> public Style(INativeElement nativeElement) { _nativeElement = nativeElement; }
private bool IsMatchByTag(INativeElement nativeElement) { return(ElementTag.IsMatch(ElementTags, nativeElement)); }
/// <summary> /// Initializes a new instance of the <see cref="Area" /> class. /// Mainly used by WatiN internally. /// </summary> /// <param name="domContainer">The <see cref="DomContainer" /> the element is in.</param> /// <param name="element">The element.</param> public Area(DomContainer domContainer, INativeElement element) : base(domContainer, element) { }
public TableBody(DomContainer domContainer, INativeElement element) : base(domContainer, element) { }
public Section(DomContainer domContainer, INativeElement nativeElement) : base(domContainer, nativeElement) { }
public TestElementSameTagButInherited(DomContainer domContainer, INativeElement element) : base(domContainer, element) { }
public FileUpload(DomContainer domContainer, INativeElement element) : base(domContainer, element) { }
/// <summary> /// Returns an initialized instance of a SelectList object. /// Mainly used by the collectionclass SelectLists. /// </summary> /// <param name="domContainer">The <see cref="DomContainer"/> the element is in.</param> /// <param name="element">The HTML select element.</param> public SelectList(DomContainer domContainer, INativeElement element) : base(domContainer, element) { }
/// <summary> /// Initializes a new instance of the <see cref="Div"/> class. /// Mainly used by WatiN internally. /// </summary> /// <param name="domContainer">The DOM container.</param> /// <param name="htmlH1Element">The HTML h1 element.</param> public HeaderLevel1(DomContainer domContainer, INativeElement htmlH1Element) : base(domContainer, htmlH1Element) { }
public bool CompareInputTypes(INativeElement element) { string inputElementType = element.GetAttributeValue("type").ToLower(CultureInfo.InvariantCulture); return (InputTypes.IndexOf(inputElementType) >= 0); }
private WatinControl CreateWatinControl(INativeElement htmlElem) { Element watElem; WatinBaseControl watBaseTypeElem; int watElemIndex = 0; int sourceIdx = htmlElem.GetElementSourceIndex(); string getByTag = htmlElem.TagName; switch (getByTag) { case "AREA": watElem = new Area(browser.DomContainer, htmlElem); watBaseTypeElem = new WatinBaseControl(this, WatinBaseTypes.Areas); IEnumerator <Area> areaEnum = browser.Areas.GetEnumerator(); while (areaEnum.MoveNext()) { if (areaEnum.Current.NativeElement.GetElementSourceIndex() == sourceIdx) { break; } watElemIndex++; } return(new WatinControl(watBaseTypeElem, watElem, watElemIndex)); case "INPUT": string byType = htmlElem.GetAttributeValue("type"); switch (byType) { case "submit": case "reset": case "button": watElem = new Button(browser.DomContainer, htmlElem); watBaseTypeElem = new WatinBaseControl(this, WatinBaseTypes.Buttons); IEnumerator <Button> buttonEnum = browser.Buttons.GetEnumerator(); while (buttonEnum.MoveNext()) { if (buttonEnum.Current.NativeElement.GetElementSourceIndex() == sourceIdx) { break; } watElemIndex++; } return(new WatinControl(watBaseTypeElem, watElem, watElemIndex)); case "checkbox": watElem = new CheckBox(browser.DomContainer, htmlElem); watBaseTypeElem = new WatinBaseControl(this, WatinBaseTypes.CheckBoxes); IEnumerator <CheckBox> cbEnum = browser.CheckBoxes.GetEnumerator(); while (cbEnum.MoveNext()) { if (cbEnum.Current.NativeElement.GetElementSourceIndex() == sourceIdx) { break; } watElemIndex++; } return(new WatinControl(watBaseTypeElem, watElem, watElemIndex)); case "file": watElem = new FileUpload(browser.DomContainer, htmlElem); watBaseTypeElem = new WatinBaseControl(this, WatinBaseTypes.FileUploads); IEnumerator <FileUpload> fuEnum = browser.FileUploads.GetEnumerator(); while (fuEnum.MoveNext()) { if (fuEnum.Current.NativeElement.GetElementSourceIndex() == sourceIdx) { break; } watElemIndex++; } return(new WatinControl(watBaseTypeElem, watElem, watElemIndex)); case "hidden": case "password": case "text": case "textarea": watElem = new TextField(browser.DomContainer, htmlElem); watBaseTypeElem = new WatinBaseControl(this, WatinBaseTypes.TextFields); IEnumerator <TextField> tfEnum = browser.TextFields.GetEnumerator(); while (tfEnum.MoveNext()) { if (tfEnum.Current.NativeElement.GetElementSourceIndex() == sourceIdx) { break; } watElemIndex++; } return(new WatinControl(watBaseTypeElem, watElem, watElemIndex)); case "radio": watElem = new RadioButton(browser.DomContainer, htmlElem); watBaseTypeElem = new WatinBaseControl(this, WatinBaseTypes.RadioButtons); IEnumerator <RadioButton> rbEnum = browser.RadioButtons.GetEnumerator(); while (rbEnum.MoveNext()) { if (rbEnum.Current.NativeElement.GetElementSourceIndex() == sourceIdx) { break; } watElemIndex++; } return(new WatinControl(watBaseTypeElem, watElem, watElemIndex)); } break; case "DIV": watElem = new Div(browser.DomContainer, htmlElem); watBaseTypeElem = new WatinBaseControl(this, WatinBaseTypes.Divs); IEnumerator <Div> divEnum = browser.Divs.GetEnumerator(); while (divEnum.MoveNext()) { if (divEnum.Current.NativeElement.GetElementSourceIndex() == sourceIdx) { break; } watElemIndex++; } return(new WatinControl(watBaseTypeElem, watElem, watElemIndex)); case "FORM": watElem = new Form(browser.DomContainer, htmlElem); watBaseTypeElem = new WatinBaseControl(this, WatinBaseTypes.Forms); IEnumerator <Form> formEnum = browser.Forms.GetEnumerator(); while (formEnum.MoveNext()) { if (formEnum.Current.NativeElement.GetElementSourceIndex() == sourceIdx) { break; } watElemIndex++; } return(new WatinControl(watBaseTypeElem, watElem, watElemIndex)); case "FRAME": case "IFRAME": //watFrame = new Frame(browser.DomContainer, htmlElem); //watBaseTypeElem = new WatinBaseControl(this, WatinBaseTypes.Forms); //IEnumerator<Form> formEnum = browser.Forms.GetEnumerator(); //while (formEnum.MoveNext()) //{ // if (formEnum.Current.NativeElement.GetElementSourceIndex() == sourceIdx) // break; // watElemIndex++; //} //return new WatinControl(watBaseTypeElem, watElem, watElemIndex); break; case "IMG": watElem = new Image(browser.DomContainer, htmlElem); watBaseTypeElem = new WatinBaseControl(this, WatinBaseTypes.Images); IEnumerator <Image> imgEnum = browser.Images.GetEnumerator(); while (imgEnum.MoveNext()) { if (imgEnum.Current.NativeElement.GetElementSourceIndex() == sourceIdx) { break; } watElemIndex++; } return(new WatinControl(watBaseTypeElem, watElem, watElemIndex)); case "LABLE": watElem = new Label(browser.DomContainer, htmlElem); watBaseTypeElem = new WatinBaseControl(this, WatinBaseTypes.Labels); IEnumerator <Label> lblEnum = browser.Labels.GetEnumerator(); while (lblEnum.MoveNext()) { if (lblEnum.Current.NativeElement.GetElementSourceIndex() == sourceIdx) { break; } watElemIndex++; } return(new WatinControl(watBaseTypeElem, watElem, watElemIndex)); case "A": watElem = new Link(browser.DomContainer, htmlElem); watBaseTypeElem = new WatinBaseControl(this, WatinBaseTypes.Links); IEnumerator <Link> lnkEnum = browser.Links.GetEnumerator(); while (lnkEnum.MoveNext()) { if (lnkEnum.Current.NativeElement.GetElementSourceIndex() == sourceIdx) { break; } watElemIndex++; } return(new WatinControl(watBaseTypeElem, watElem, watElemIndex)); case "P": watElem = new Para(browser.DomContainer, htmlElem); watBaseTypeElem = new WatinBaseControl(this, WatinBaseTypes.Paras); IEnumerator <Para> paraEnum = browser.Paras.GetEnumerator(); while (paraEnum.MoveNext()) { if (paraEnum.Current.NativeElement.GetElementSourceIndex() == sourceIdx) { break; } watElemIndex++; } return(new WatinControl(watBaseTypeElem, watElem, watElemIndex)); case "SELECT": watElem = new SelectList(browser.DomContainer, htmlElem); watBaseTypeElem = new WatinBaseControl(this, WatinBaseTypes.SelectLists); IEnumerator <SelectList> slEnum = browser.SelectLists.GetEnumerator(); while (slEnum.MoveNext()) { if (slEnum.Current.NativeElement.GetElementSourceIndex() == sourceIdx) { break; } watElemIndex++; } return(new WatinControl(watBaseTypeElem, watElem, watElemIndex)); case "SPAN": watElem = new Span(browser.DomContainer, htmlElem); watBaseTypeElem = new WatinBaseControl(this, WatinBaseTypes.Spans); IEnumerator <Span> spanEnum = browser.Spans.GetEnumerator(); while (spanEnum.MoveNext()) { if (spanEnum.Current.NativeElement.GetElementSourceIndex() == sourceIdx) { break; } watElemIndex++; } return(new WatinControl(watBaseTypeElem, watElem, watElemIndex)); case "TBODY": watElem = new TableBody(browser.DomContainer, htmlElem); watBaseTypeElem = new WatinBaseControl(this, WatinBaseTypes.TableBodies); IEnumerator <TableBody> tbEnum = browser.TableBodies.GetEnumerator(); while (tbEnum.MoveNext()) { if (tbEnum.Current.NativeElement.GetElementSourceIndex() == sourceIdx) { break; } watElemIndex++; } return(new WatinControl(watBaseTypeElem, watElem, watElemIndex)); case "TD": watElem = new TableCell(browser.DomContainer, htmlElem); watBaseTypeElem = new WatinBaseControl(this, WatinBaseTypes.TableCells); IEnumerator <TableCell> tdEnum = browser.TableCells.GetEnumerator(); while (tdEnum.MoveNext()) { if (tdEnum.Current.NativeElement.GetElementSourceIndex() == sourceIdx) { break; } watElemIndex++; } return(new WatinControl(watBaseTypeElem, watElem, watElemIndex)); case "TR": watElem = new TableRow(browser.DomContainer, htmlElem); watBaseTypeElem = new WatinBaseControl(this, WatinBaseTypes.TableRows); IEnumerator <TableRow> trEnum = browser.TableRows.GetEnumerator(); while (trEnum.MoveNext()) { if (trEnum.Current.NativeElement.GetElementSourceIndex() == sourceIdx) { break; } watElemIndex++; } return(new WatinControl(watBaseTypeElem, watElem, watElemIndex)); case "TABLE": watElem = new Table(browser.DomContainer, htmlElem); watBaseTypeElem = new WatinBaseControl(this, WatinBaseTypes.Tables); IEnumerator <Table> tableEnum = browser.Tables.GetEnumerator(); while (tableEnum.MoveNext()) { if (tableEnum.Current.NativeElement.GetElementSourceIndex() == sourceIdx) { break; } watElemIndex++; } return(new WatinControl(watBaseTypeElem, watElem, watElemIndex)); case "TEXTAREA": watElem = new TextField(browser.DomContainer, htmlElem); watBaseTypeElem = new WatinBaseControl(this, WatinBaseTypes.TextFields); IEnumerator <TextField> taEnum = browser.TextFields.GetEnumerator(); while (taEnum.MoveNext()) { if (taEnum.Current.NativeElement.GetElementSourceIndex() == sourceIdx) { break; } watElemIndex++; } return(new WatinControl(watBaseTypeElem, watElem, watElemIndex)); default: return(null); } return(null); }
public ElementTag(INativeElement nativeElement) : this(nativeElement.TagName, getInputType(nativeElement)) {}
/// <summary> /// Initializes a new instance of the <see cref="ListItem"/> class. /// Mainly used by WatiN internally. /// </summary> /// <param name="domContainer">The DOM container.</param> /// <param name="nativeElement">The HTML li element.</param> public ListItem(DomContainer domContainer, INativeElement nativeElement) : base(domContainer, nativeElement) { }
public StaticElementFinder(DomContainer domcontainer, INativeElement nativeElement) : base(CreateTagList(nativeElement), Find.First()) { _domContainer = domcontainer; _nativeElement = nativeElement; }
public static string GetInputType(INativeElement nativeElement) { return(IsAnInputElement(nativeElement.TagName) ? nativeElement.GetAttributeValue("type") : null); }
private static string GetBackgroundColor(INativeElement nativeElement) { return nativeElement.GetStyleAttributeValue("backgroundColor"); }
public Para(DomContainer domContainer, INativeElement htmlParaElement) : base(domContainer, htmlParaElement) { }
public MyButtonWithNoElementTag(DomContainer domContainer, INativeElement element) : base(domContainer, element) { }
public Label(DomContainer domContainer, INativeElement labelElement) : base(domContainer, labelElement) { }
public TextFieldExtended(DomContainer domContainer, INativeElement element) : base(domContainer, element) { }
public TestElementSameTagButInherited(DomContainer domContainer, INativeElement element) : base(domContainer, element) { }
public TableRow(DomContainer domContainer, INativeElement htmlTableRow) : base(domContainer, htmlTableRow) { }
public Form(DomContainer domContainer, INativeElement htmlFormElement) : base(domContainer, htmlFormElement) { }
public ElementsContainer(DomContainer domContainer, INativeElement nativeElement) : base(domContainer, nativeElement) { }
/// <summary> /// Initializes a new instance of the <see cref="Style"/> class. /// </summary> /// <param name="nativeElement">The underlying <see cref="INativeElement"/>.</param> public Style(INativeElement nativeElement) { _nativeElement = nativeElement; }
private bool CompareTagName(INativeElement nativeElement) { if (TagName == null) return true; return StringComparer.AreEqual(TagName, nativeElement.TagName, true); }
private Element WrapElementIfMatch(INativeElement nativeElement, ConstraintContext context) { nativeElement.WaitUntilReady(); if (IsMatchByTag(nativeElement)) { var element = WrapElement(nativeElement); if (element == null) return null; if (IsMatchByConstraint(element, context)) return element; } return null; }
public static bool IsValidElement(INativeElement nativeElement, ArrayList elementTags) { if (nativeElement == null) return false; foreach (ElementTag elementTag in elementTags) { if (elementTag.Compare(nativeElement)) { return true; } } return false; }
private bool IsMatchByTag(INativeElement nativeElement) { return ElementTag.IsMatch(ElementTags, nativeElement); }
private static string GetBackgroundColor(INativeElement nativeElement) { return(nativeElement.GetStyleAttributeValue("backgroundColor")); }
private Element WrapElement(INativeElement nativeElement) { return(WrapNativeElementFactory(domContainer, nativeElement)); }
private Element WrapElement(INativeElement nativeElement) { return ElementFactory.CreateElement(domContainer, nativeElement); }
private static void SetBackgroundColor(INativeElement nativeElement, string color) { nativeElement.SetStyleAttributeValue("backgroundColor", color ?? ""); }
public CustomNativeElement(INativeElement inner, Document doc) : base(inner) { _doc = doc; }
public StaticElementFinder(DomContainer domcontainer, INativeElement nativeElement) : base(CreateTagList(nativeElement), Find.First()) { _domContainer = domcontainer; _nativeElement = nativeElement; }
private static IList<ElementTag> CreateTagList(INativeElement nativeElement) { return new[] { ElementTag.FromNativeElement(nativeElement) }; }
private static IList <ElementTag> CreateTagList(INativeElement nativeElement) { return(new[] { ElementTag.FromNativeElement(nativeElement) }); }
/// <summary> /// Initializes a new instance of the <see cref="Option"/> class. /// </summary> /// <param name="domContainer">The domContainer.</param> /// <param name="element">The option element.</param> public Option(DomContainer domContainer, INativeElement element) : base(domContainer, element) { }
public Span(DomContainer domContainer, INativeElement htmlSpanElement) : base(domContainer, htmlSpanElement) { }
private static void SetBackgroundColor(INativeElement nativeElement, string color) { nativeElement.SetStyleAttributeValue("backgroundColor", color ?? ""); }
public RadioButton(DomContainer domContainer, INativeElement inputElement) : base(domContainer, inputElement) { }
public TextFieldExtended(DomContainer domContainer, INativeElement element) : base(domContainer, element) { }
public MyButton(DomContainer domContainer, INativeElement element) : base(domContainer, element) { }