private void OnLeftButtonUp(object sender, System.Windows.Forms.HtmlElementEventArgs arg) { System.Windows.Forms.HtmlDocument doc = (System.Windows.Forms.HtmlDocument)sender; System.Windows.Forms.HtmlElement element = doc.GetElementFromPoint(arg.MousePosition); HtmlScreenElementBase button = FindButtonInHtml(element); if (null == button) { System.Windows.Forms.HtmlElement parentElement = element.Parent; if (null == parentElement) { return; } button = FindButtonInHtml(parentElement); if (null == button) { return; } } button.OnLeftMouseUp(sender, arg); arg.ReturnValue = true; }
/// <summary> /// When saving the CodeCommander file source, receipts and updates infos from the tml element of the web navigator /// </summary> /// <param name="elem">html element</param> public void Update(System.Windows.Forms.HtmlElement elem) { Int32.TryParse(elem.GetAttribute("indent"), out this.indent); this.language = this.GetElementByName(elem, "language").InnerText; this.name = this.GetElementByName(elem, "name").InnerText; string strParams = this.GetElementByName(elem, "params").InnerText; this.refs.Clear(); if (!String.IsNullOrEmpty(strParams)) { string[] tab = strParams.Split(','); foreach (string param in tab) { string name = param.Trim(); if (name.StartsWith(CreateMOP.ParamIdentifier.ToString())) { name = name.Substring(1).Trim(); } if (!String.IsNullOrEmpty(name)) { if (!this.refs.Contains(name)) { this.refs.Add(name); } } } } // mise à jour des legendes this.legendes.Update(this.GetElementByName(elem, "myLegendes")); this.xmlCode = this.GetElementByName(elem, "xml").InnerHtml; }
public void Update(System.Windows.Forms.HtmlElement elem) { Int32.TryParse(elem.GetAttribute("indent"), out this.indent); this.tabName = this.GetElementByName(elem, "tableau").InnerText; this.expression = this.GetElementByName(elem, "expression").InnerText; this.fieldName = this.GetElementByName(elem, "champ").InnerText; }
private async Task HookScript(WebBrowser webBrowser, Uri uri) { var tmp = uri.ToString().Split(new[] { '/', '\\' }); var fileName = tmp[tmp.Length - 1]; tmp = fileName.Split('.'); fileName = tmp[0]; if (WebBrowser.Document.GetElementById($"Hook_{fileName}Script") != null) { return; } var scriptStream = Application.GetResourceStream(uri); StreamReader streamReader = new StreamReader(scriptStream.Stream); var script = await streamReader.ReadToEndAsync(); HtmlElement head = WebBrowser.Document.GetElementsByTagName("head")[0]; HtmlElement scriptEl = WebBrowser.Document.CreateElement("script"); IHTMLScriptElement element = (IHTMLScriptElement)scriptEl.DomElement; ((IHTMLElement)element).id = $"Hook_{fileName}Script"; element.text = script; head.AppendChild(scriptEl); }
public void ClickElement(System.Windows.Forms.HtmlElement ElementToClick, System.Windows.Forms.TextBox txtDisplay) { try { if (goToURLTimer.Tag == null) { goToURLTimer.Stop(); //this is how long before the link is clicked TimerInfo timerInfo = new TimerInfo(); timerInfo.StartTime = DateTime.Now; timerInfo.ElementToClick = ElementToClick; timerInfo.Duration = TimeSpan.FromSeconds(randomSeconds(11, 4)); timerInfo.TxtDisplay = txtDisplay; goToURLTimer.Tag = timerInfo; goToURLTimer.Tick += Timer_Tick; goToURLTimer.Start(); //keepRunning_tour_Timer.Stop(); //keepRunning_tour_Timer.Tag = null; } } catch (Exception ex) { //Tools.WriteToFile(ex); throw; //Application.Restart(); } }
/// <summary> /// Saving the object into an xml node /// </summary> /// <param name="comp">this compiler</param> /// <param name="writer">Xml writer object</param> /// <param name="child">html child for nested objects</param> public void Save(ICompilateur comp, System.Xml.XmlWriter writer, ref System.Windows.Forms.HtmlElement child) { writer.WriteStartElement("createmop"); writer.WriteAttributeString("language", this.language); writer.WriteAttributeString("name", this.name); if (this.indent > 0) { writer.WriteAttributeString("indent", this.indent.ToString()); } writer.WriteStartElement("legendes"); this.legendes.Save(writer); writer.WriteEndElement(); writer.WriteStartElement("references"); foreach (string param in this.refs) { writer.WriteStartElement("ref"); writer.WriteString(param); writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteStartElement("code"); writer.WriteRaw(this.xmlCode); writer.WriteEndElement(); writer.WriteEndElement(); child = child.NextSibling; }
private static void ClearControls(System.Windows.Forms.HtmlElement e) { if (new[] { "BUTTON", "INPUT" }.Contains(e.TagName)) { e.OuterHtml = ""; } }
private void document_MouseOver(object sender, System.Windows.Forms.HtmlElementEventArgs e) { System.Windows.Forms.HtmlElement element = e.ToElement; string dozmiany = element.OuterHtml; //textEditor1.Text = "ttttttttttttt" + dozmiany; if (!this.elementStyles.ContainsKey(element)) { string style = element.Style; this.elementStyles.Add(element, style); //element.SetAttribute("data-tooltip", "tooooltip"); //element.Style = style + "background-color: #ffc;border: 2px dotted #000000;background-clip:border-box"; // border - color: coral; border-style: solid; // element.Style = style + ";data-tooltip=\"Custom tooltip text.\";"; // element.Style = style + "; padding: 15px;"; // data-tooltip="Custom tooltip text." if (element.GetAttribute("className") != "") { element.Style = style + "background-color: rgba(30, 163, 97, 0.25);border: 2px dotted #000000;background-clip:border-box"; } else { element.Style = style + "background-color: rgba(255, 2, 2, 0.25);border: 2px dotted #000000;background-clip:border-box"; } } //string ffff = wartosc.XPath; }
public void Update(System.Windows.Forms.HtmlElement elem) { Int32.TryParse(elem.GetAttribute("indent"), out this.indent); this.expression = this.GetElementByName(elem, "expression").InnerText; this.labelTrue = this.GetElementByName(elem, "labelTrue").InnerText; this.labelFalse = this.GetElementByName(elem, "labelFalse").InnerText; }
private HtmlScreenElementBase CreateInputElement(System.Windows.Forms.HtmlElement argElement) { Debug.Assert(null != argElement); string format = argElement.GetAttribute(s_formatAttri); HtmlScreenInputElement screenInput = new HtmlScreenInputElement(argElement, this); if (!string.IsNullOrEmpty(format)) { screenInput.FormatPattern = format; } screenInput.ParseBindingExpress(); //show virtual keyboard string showVKeyboard = argElement.GetAttribute(UIPropertyKey.s_showVirtualKeyboard); if (!string.IsNullOrEmpty(showVKeyboard)) { int value = 0; if (int.TryParse(showVKeyboard, out value)) { screenInput.CanShowVirtualKeyboard = value == 0 ? false : true; } else { screenInput.CanShowVirtualKeyboard = false; } } return(screenInput); }
//Má na starosti extrakci přímých odkazů z podporovaných stránek private void ResolveLink() { string href = ""; if (Provider == Providers.Zippyshare) { System.Windows.Forms.HtmlElement element = webBrowser.Document.GetElementById("dlbutton"); if (element != null) { href = element.GetAttribute("href"); } else { OnExtractionError?.Invoke(Lang.Translate("lang_unable_to_extract")); return; } } else if (Provider == Providers.Openload) { System.Windows.Forms.HtmlElement element = webBrowser.Document.GetElementById("streamurj"); if (element != null) { href = "/stream/" + element.InnerText; } else { OnExtractionError?.Invoke(Lang.Translate("lang_unable_to_extract")); return; } } Uri uri = new Uri(new Uri(webBrowser.Url.AbsoluteUri), href); OnExtractionCompleted?.Invoke(WebUtility.UrlDecode(uri.AbsoluteUri)); }
private void writeElement(string type, System.Windows.Forms.HtmlElement element) { sheet.WriteNextRow(); sheet.WriteTextCell(1, _writer.AddSharedString(type)); string attr = null, attrValue = null; IHTMLDOMNode node = element.DomElement as IHTMLDOMNode; IHTMLDOMAttribute2 domAttr = null; int columnIndex = 2; for (; columnIndex - 2 < _excelColumnHeader.Count; columnIndex++) { attr = _excelColumnHeader[columnIndex - 2] as string; if (string.IsNullOrEmpty(attr)) { attrValue = ""; } else { domAttr = node.attributes.getNamedItem(attr); if (domAttr != null) { attrValue = domAttr.value; } } if (attrValue != "null" && string.IsNullOrEmpty(attrValue) == false) { sheet.WriteTextCell(columnIndex, _writer.AddSharedString(attrValue)); } attrValue = null; domAttr = null; } }
public void Freeze() { WaitReadyBrowser(); _lastDocumentBody = ActiveDocument.CreateElement("<body>"); _lastDocumentBody.InnerHtml = ActiveDocument.Body.InnerHtml; _frozen = true; UpdateInlineWaitAnimation(); }
public virtual bool Open(System.Windows.Forms.HtmlElement argElement) { Debug.Assert(null != argElement); m_name = argElement.Id; return(true); }
private HtmlScreenElementBase CreateSelectElement(System.Windows.Forms.HtmlElement argElement) { Debug.Assert(null != argElement); HtmlScreenElementBase selectElement = new HtmlScreenSelectElement(argElement, this); selectElement.ParseBindingExpress(); return(selectElement); }
private HtmlScreenElementBase CreateCountDownElement(System.Windows.Forms.HtmlElement argElement) { Debug.Assert(null != argElement); HtmlScreenElementBase screenCountDown = new HtmlScreenCountdownElement(argElement, this); screenCountDown.ParseBindingExpress(); return(screenCountDown); }
public void Save(ICompilateur comp, System.Xml.XmlWriter writer, ref System.Windows.Forms.HtmlElement child) { writer.WriteStartElement("br"); if (this.indent > 0) { writer.WriteAttributeString("indent", this.indent.ToString()); } writer.WriteEndElement(); child = child.NextSibling; }
/// <summary> /// Update from the web browser /// </summary> /// <param name="elem">html element</param> public void Update(System.Windows.Forms.HtmlElement elem) { // un update des legendes => on efface les anciennes legendes this.Clear(); foreach (System.Windows.Forms.HtmlElement child in elem.Children) { Legende leg = new Legende(); leg.Update(child); this.legendes.Add(leg); } }
public void Unfreeze() { if (_frozen) { WaitReadyBrowser(); ActiveDocument.Body.InnerHtml = _lastDocumentBody.InnerHtml; _frozen = false; _lastDocumentBody = null; UpdateInlineWaitAnimation(false); } }
private void document_MouseLeave(object sender, System.Windows.Forms.HtmlElementEventArgs e) { System.Windows.Forms.HtmlElement element = e.FromElement; if (this.elementStyles.ContainsKey(element)) { string style = this.elementStyles[element]; this.elementStyles.Remove(element); element.Style = style; } }
private HtmlScreenElementBase CreateButtonElement(System.Windows.Forms.HtmlElement argElement) { Debug.Assert(null != argElement); HtmlScreenElementBase screenButton = new HtmlScreenButtonElement(argElement, this); screenButton.ParseBindingExpress(); screenButton.ParseResource(); return(screenButton); }
/// <summary> /// Updates data from the web browser (before save) /// </summary> /// <param name="elem">html element</param> public void Update(System.Windows.Forms.HtmlElement elem) { Int32.TryParse(elem.GetAttribute("indent"), out this.indent); this.language = this.GetElementByName(elem, "language").InnerText; if (String.IsNullOrEmpty(this.language)) { this.language = ""; } this.command = this.GetElementByName(elem, "command").InnerText; this.expression = this.GetElementByName(elem, "expression").InnerText; }
/// <summary> /// Save this statement into an xml file /// </summary> /// <param name="comp">compiler object</param> /// <param name="writer">xml writer object</param> /// <param name="child">html child to save</param> public void Save(ICompilateur comp, System.Xml.XmlWriter writer, ref System.Windows.Forms.HtmlElement child) { writer.WriteStartElement("usemop"); writer.WriteAttributeString("language", this.language); writer.WriteAttributeString("command", this.command); writer.WriteAttributeString("expression", this.expression); if (this.indent > 0) { writer.WriteAttributeString("indent", this.indent.ToString()); } writer.WriteEndElement(); child = child.NextSibling; }
System.Windows.Forms.HtmlElement Finding_Parent_With_Identifier(System.Windows.Forms.HtmlElement element) { // System.Windows.Forms.HtmlElement parent = element.Parent; string className = element.GetAttribute("className"); string idName = element.GetAttribute("id"); string name = element.GetAttribute("name").Trim(); string tagName = element.TagName; parentCounting++; return(idName != string.Empty ? element : Finding_Parent_With_Identifier(element.Parent)); }
/// <summary> /// Updates data from the web browser (before save) /// </summary> /// <param name="elem">html element</param> public void Update(System.Windows.Forms.HtmlElement elem) { Int32.TryParse(elem.GetAttribute("indent"), out this.indent); string name = this.GetElementByName(elem, "name").InnerText; if (String.IsNullOrEmpty(name)) { name = ""; } this.name = name; // mise à jour des légendes this.legendes.Update(this.GetElementByName(elem, "myLegendes")); this.xmlCode = this.GetElementByName(elem, "xml").InnerHtml; }
public void Save(ICompilateur comp, System.Xml.XmlWriter writer, ref System.Windows.Forms.HtmlElement child) { writer.WriteStartElement("parallel"); if (this.indent > 0) { writer.WriteAttributeString("indent", this.indent.ToString()); } writer.WriteStartElement("code"); // search next sibling child of code System.Windows.Forms.HtmlElement subElement = child.NextSibling; comp.Save(writer, ref subElement, this.indent + 1); writer.WriteEndElement(); writer.WriteEndElement(); child = subElement; }
public void scrapData(string Url, int cantidad) { browser = new System.Windows.Forms.WebBrowser(); browser.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(DocumentCompleted); HtmlDocument document = null; int contador = 0; HtmlWeb web = new HtmlWeb(); while (contador <= cantidad) { browser.Navigate(Url); browser.Visible = true; browser.Refresh(); while (completed) { System.Windows.Forms.Application.DoEvents(); Thread.Sleep(100); botonClik = browser.Document.GetElementById("btnMoreResults"); botonClik.InvokeMember("click"); document = (HtmlDocument)browser.Document.DomDocument; HtmlNode[] nodes = document.DocumentNode.SelectNodes(".//a/@href").ToArray(); Console.Write("Buscando Recetas....."); using (var progress = new ProgressBar()) { foreach (HtmlNode enlace in nodes) { foreach (HtmlAttribute atributo in enlace.Attributes) { if (RegexTool.isUrl(atributo.Value)) { HtmlDocument recipe = web.Load(atributo.Value); if (hasRecipe(recipe)) { contador++; progress.Report((double)contador / cantidad); Thread.Sleep(20); getMicroData(recipe); } } } } } } } Console.WriteLine("Listo."); Console.ReadLine(); }
/// <summary> /// Updates data from the web browser (before save) /// </summary> /// <param name="elem">html element</param> public void Update(System.Windows.Forms.HtmlElement elem) { Int32.TryParse(elem.GetAttribute("indent"), out this.indent); string path = this.GetElementByName(elem, "path").InnerText; if (String.IsNullOrEmpty(path)) { path = ""; } int pos = path.LastIndexOf("/"); if (pos != -1) { this.path = path.Substring(0, pos); this.name = path.Substring(pos + 1); } else { this.name = path; this.path = ""; } string strParams = this.GetElementByName(elem, "params").InnerText; this.pars = new Dictionary <string, string>(); if (!String.IsNullOrEmpty(strParams)) { string[] tab = strParams.Split(','); foreach (string param in tab) { string name = String.Empty; if (param.Trim().StartsWith(Template.ParamIdentifier.ToString())) { name = param.Trim().Substring(1).Trim(); } else { name = param.Trim(); } if (!this.pars.ContainsKey(name)) { this.pars.Add(name, ""); } } } // mise à jour des legendes this.legendes.Update(this.GetElementByName(elem, "myLegendes")); this.xmlCode = this.GetElementByName(elem, "xml").InnerHtml; }
void document_MouseDown(object sender, System.Windows.Forms.HtmlElementEventArgs e) { System.Windows.Forms.HtmlElement element = this.web.Document.GetElementFromPoint(e.ClientMousePosition); //string right_button_capture = element.GetAttribute("id"); //selenium_id= htmlDocument2.body.document.document.getElementById("username"); selenium_id = element.GetAttribute("id").Trim(); selenium_name = element.GetAttribute("name").Trim(); selenium_tagName = element.TagName.ToString(); //MessageBox.Show("tag name=" + selenium_tagName + " name=" + selenium_name + " id=" + selenium_id); if (e.MouseButtonsPressed == System.Windows.Forms.MouseButtons.Right) { //MessageBox.Show(right_button_capture); } }
public void Save(ICompilateur comp, System.Xml.XmlWriter writer, ref System.Windows.Forms.HtmlElement child) { writer.WriteStartElement("affectation"); if (this.indent > 0) { writer.WriteAttributeString("indent", this.indent.ToString()); } writer.WriteStartElement("variable"); writer.WriteString(this.varName); writer.WriteEndElement(); writer.WriteStartElement("expression"); writer.WriteString(this.expression); writer.WriteEndElement(); writer.WriteEndElement(); child = child.NextSibling; }