Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This will be helpful if you want to capture only mouse clicks:</p> <pre><code>WebBrowser _browser; this._browser.DocumentCompleted+=new WebBrowserDocumentCompletedEventHandler(browser_DocumentCompleted); ... private void browser_DocumentCompleted(Object sender, WebBrowserDocumentCompletedEventArgs e) { this._browser.Document.Body.MouseDown += new HtmlElementEventHandler(Body_MouseDown); } ... void Body_MouseDown(Object sender, HtmlElementEventArgs e) { switch(e.MouseButtonsPressed) { case MouseButtons.Left: HtmlElement element = this._browser.Document.GetElementFromPoint(e.ClientMousePosition); if(element != null &amp;&amp; "submit".Equals(element.GetAttribute("type"),StringComparison.OrdinalIgnoreCase) { } break; } } </code></pre> <blockquote> <p>can u please tell me how can i read custom attribute of any html element loaded inside web browser control. thanks</p> </blockquote> <p>If You don't want to link to "Microsoft.mshtml", You can try to use this sample method. But you can't read all members thru reflection:</p> <pre><code>public static String GetElementPropertyValue(HtmlElement element, String property) { if(element == null) throw new ArgumentNullException("element"); if(String.IsNullOrEmpty(property)) throw new ArgumentNullException("property"); String result = element.GetAttribute(property); if(String.IsNullOrEmpty(result)) {//В MSIE 9 получить свойство через DomElement не получается. Т.к. там он ComObject. var objProperty = element.DomElement.GetType().GetProperty(property); if(objProperty != null) { Object value = objProperty.GetValue(element.DomElement, null); result = value == null ? String.Empty : value.ToString(); } } return result; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload