public SUIHtmlDocument GetFrame(SUIHtmlControlBase frameControl) { SUIHtmlDocument frame = null; if (frameControl.TagName != null && frameControl.TagName.Equals("FRAME")) { int index = 0; List <SUIHtmlControlBase> frameTags = GetElementsByTagName("Frame"); if (frameTags.Count != 0) { foreach (SUIHtmlControlBase ctrl in frameTags) { if (frameControl.Name.Equals(ctrl.Name)) { break; } index++; } List <SUIHtmlDocument> frames = Frames; if (index != frameTags.Count && index < frames.Count) { frame = frames[index]; } } } return(frame); }
public SUIHtmlControlBase SearchHtmlElementByID(string tagName, string id, int index) { List <SUIHtmlControlBase> list = GetElementsByTagName(tagName); int i = 0; Regex regex = new Regex("[0-9]+"); string ctrlID = null; foreach (SUIHtmlControlBase ctrl in list) { if (ctrl.ID != null) { ctrlID = regex.Replace(ctrl.ID, "*"); } if ((ctrl.ID != null && ctrlID.Equals(id)) || (ctrl.ID == null && id == null)) { if (i == index) { SUIHtmlControlBase newCtrl = new SUIHtmlControlBase(ctrl); return(newCtrl); } i++; } } return(null); }
public static bool IsDivElement(SUIHtmlControlBase ctrl) { bool itis = false; try { IHTMLDivElement span = ctrl.HtmlElement as mshtml.IHTMLDivElement; itis = true; } catch { itis = false; } return itis; }
public static bool IsSelectElement(SUIHtmlControlBase ctrl) { bool itis = false; try { IHTMLSelectElement select = ctrl.HtmlElement as IHTMLSelectElement; int size = select.size; itis = true; } catch { itis = false; } return itis; }
public static bool IsSpanElement(SUIHtmlControlBase ctrl) { bool itis = false; try { IHTMLSpanElement span = ctrl.HtmlElement as mshtml.IHTMLSpanElement; itis = true; } catch { itis = false; } return(itis); }
public static bool IsAnchorElement(SUIHtmlControlBase ctrl) { bool itis = false; try { IHTMLAnchorElement anchor = ctrl.HtmlElement as IHTMLAnchorElement; string href = anchor.href; itis = true; } catch { itis = false; } return itis; }
public static bool IsInputButtonElement(SUIHtmlControlBase ctrl) { bool itis = false; try { IHTMLInputButtonElement input = ctrl.HtmlElement as IHTMLInputButtonElement; string value = input.value; itis = true; } catch { itis = false; } return itis; }
public static bool IsInputTextElement(SUIHtmlControlBase ctrl) { bool itis = false; try { IHTMLInputElement input = ctrl.HtmlElement as IHTMLInputElement; if (input.type.ToLower() == "text" || input.type.ToLower() == "password") itis = true; } catch { itis = false; } return itis; }
public static bool IsInputButtonElement(SUIHtmlControlBase ctrl) { bool itis = false; try { IHTMLInputButtonElement input = ctrl.HtmlElement as IHTMLInputButtonElement; string value = input.value; itis = true; } catch { itis = false; } return(itis); }
public static bool IsAnchorElement(SUIHtmlControlBase ctrl) { bool itis = false; try { IHTMLAnchorElement anchor = ctrl.HtmlElement as IHTMLAnchorElement; string href = anchor.href; itis = true; } catch { itis = false; } return(itis); }
public static bool IsSelectElement(SUIHtmlControlBase ctrl) { bool itis = false; try { IHTMLSelectElement select = ctrl.HtmlElement as IHTMLSelectElement; int size = select.size; itis = true; } catch { itis = false; } return(itis); }
public SUIHtmlControlBase SearchHtmlElementByText(string tagName, string text, int index) { if (text == "null") { text = null; } List <SUIHtmlControlBase> list = GetElementsByTagName(tagName); int i = 0; string str = null; foreach (SUIHtmlControlBase ctrl in list) { if (ctrl.InnerText != null) { if (ctrl.InnerText.Length > 50) { str = ctrl.InnerText.Substring(0, 50);//Only use the first 50 chars. } else { str = ctrl.InnerText; } if (str.IndexOf("\r\n") > -1) { str = str.Substring(0, str.IndexOf("\r\n")); } } else { str = null; } if ((str != null && str.Equals(text)) || (str == null && text == null)) { if (i == index) { SUIHtmlControlBase newCtrl = new SUIHtmlControlBase(ctrl); return(newCtrl); } i++; } } return(null); }
public static bool IsInputTextElement(SUIHtmlControlBase ctrl) { bool itis = false; try { IHTMLInputElement input = ctrl.HtmlElement as IHTMLInputElement; if (input.type.ToLower() == "text" || input.type.ToLower() == "password") { itis = true; } } catch { itis = false; } return(itis); }
public SUIHtmlControlBase ElementFromPoint(int x, int y) { SUIHtmlControlBase ctrl = null; IHTMLElement element = this.IHTMLDocument2.elementFromPoint(x, y); if (element != null) { ctrl = new SUIHtmlControlBase(this, element); } if (ctrl.TagName != null && ctrl.TagName.Equals("FRAME")) { SUIHtmlDocument frame = GetFrame(ctrl); //TODO: implement the logic for embedding frames. //ctrl = frame.ElementFromPoint(x, y); } return(ctrl); }
public List <SUIHtmlControlBase> GetElementsByTagName(string tagName) { List <SUIHtmlControlBase> list = new List <SUIHtmlControlBase>(); foreach (IHTMLElement e in IHTMLDocument3.getElementsByTagName(tagName)) { SUIHtmlControlBase ctrl = new SUIHtmlControlBase(this, e); list.Add(ctrl); } //Get elements in frames. foreach (SUIHtmlDocument frame in Frames) { foreach (IHTMLElement eInFrame in frame.IHTMLDocument3.getElementsByTagName(tagName)) { SUIHtmlControlBase ctrl = new SUIHtmlControlBase(this, eInFrame); list.Add(ctrl); } } return(list); }
public SUIHtmlAnchor(SUIHtmlControlBase ctrl) : base(ctrl) { }
public SUIHtmlInputButton(SUIHtmlControlBase ctrl) : base(ctrl) { buttonElement = (IHTMLInputButtonElement)ctrl.HtmlElement; }
public SUIHtmlSelect(SUIHtmlControlBase ctrl) : base(ctrl) { selectElement = (IHTMLSelectElement)ctrl.HtmlElement; }
public SUIHtmlImage(SUIHtmlControlBase ctrl) : base(ctrl) { imageElement = (IHTMLImgElement)ctrl.HtmlElement; }
public SUIHtmlSpan(SUIHtmlControlBase ctrl) : base(ctrl) { spanElement = (IHTMLSpanElement)ctrl.HtmlElement; }
public SUIHtmlInputText(SUIHtmlControlBase ctrl) : base(ctrl) { textElement = (IHTMLInputTextElement)ctrl.HtmlElement; }
public SUIHtmlControlBase SearchHtmlElementByID(string tagName, string id, int index) { List<SUIHtmlControlBase> list = GetElementsByTagName(tagName); int i = 0; Regex regex = new Regex("[0-9]+"); string ctrlID = null; foreach (SUIHtmlControlBase ctrl in list) { if (ctrl.ID != null) ctrlID = regex.Replace(ctrl.ID, "*"); if ((ctrl.ID != null && ctrlID.Equals(id)) || (ctrl.ID == null && id == null)) { if (i == index) { SUIHtmlControlBase newCtrl = new SUIHtmlControlBase(ctrl); return newCtrl; } i++; } } return null; }
public List<SUIHtmlControlBase> GetElementsByTagName(string tagName) { List<SUIHtmlControlBase> list = new List<SUIHtmlControlBase>(); foreach (IHTMLElement e in IHTMLDocument3.getElementsByTagName(tagName)) { SUIHtmlControlBase ctrl = new SUIHtmlControlBase(this, e); list.Add(ctrl); } //Get elements in frames. foreach (SUIHtmlDocument frame in Frames) { foreach (IHTMLElement eInFrame in frame.IHTMLDocument3.getElementsByTagName(tagName)) { SUIHtmlControlBase ctrl = new SUIHtmlControlBase(this, eInFrame); list.Add(ctrl); } } return list; }
public void Add(SUIHtmlControlBase ctl) { this.InnerList.Add(ctl); }
public SUIHtmlControlBase(SUIHtmlControlBase ctrl) { doc = ctrl.HtmlDocument; element = ctrl.HtmlElement; }
public SUIHtmlDiv(SUIHtmlControlBase ctrl) : base(ctrl) { divElement = (IHTMLDivElement)ctrl.HtmlElement; }
public SUIHtmlControlBase ElementFromPoint(int x, int y) { SUIHtmlControlBase ctrl = null; IHTMLElement element = this.IHTMLDocument2.elementFromPoint(x, y); if (element != null) ctrl = new SUIHtmlControlBase(this, element); if (ctrl.TagName != null && ctrl.TagName.Equals("FRAME")) { SUIHtmlDocument frame = GetFrame(ctrl); //TODO: implement the logic for embedding frames. //ctrl = frame.ElementFromPoint(x, y); } return ctrl; }
public SUIHtmlDocument GetFrame(SUIHtmlControlBase frameControl) { SUIHtmlDocument frame = null; if (frameControl.TagName != null && frameControl.TagName.Equals("FRAME")) { int index = 0; List<SUIHtmlControlBase> frameTags = GetElementsByTagName("Frame"); if (frameTags.Count != 0) { foreach (SUIHtmlControlBase ctrl in frameTags) { if (frameControl.Name.Equals(ctrl.Name)) break; index++; } List<SUIHtmlDocument> frames = Frames; if (index != frameTags.Count && index < frames.Count) { frame = frames[index]; } } } return frame; }
public SUIHtmlControlBase SearchHtmlElementByText(string tagName, string text, int index) { if (text == "null") text = null; List<SUIHtmlControlBase> list = GetElementsByTagName(tagName); int i = 0; string str = null; foreach (SUIHtmlControlBase ctrl in list) { if (ctrl.InnerText != null) { if (ctrl.InnerText.Length > 50) str = ctrl.InnerText.Substring(0, 50);//Only use the first 50 chars. else str = ctrl.InnerText; if (str.IndexOf("\r\n") > -1) str = str.Substring(0, str.IndexOf("\r\n")); } else str = null; if ((str != null && str.Equals(text)) || (str == null && text == null)) { if (i == index) { SUIHtmlControlBase newCtrl = new SUIHtmlControlBase(ctrl); return newCtrl; } i++; } } return null; }