Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If wbMain is your WebBrowser1 control, do the following.</p> <p>First, you need to get a ref to your element, lets say you want to access the first <code>&lt;A&gt;</code> link, of your page, you can loop through all if you want.</p> <p>This is in VB, but its the same sort of thing in C#, just different syntax.</p> <pre><code>Dim i As Integer Dim aElement As HTMLAnchorElement = wbMain.Document.All.getElementByTagName("A")(0) For i = 0 To aElement.attributes.length - 1 MsgBox aElement.attributes.item(i).name &amp; "=" &amp; aElement.attributes.item(i).value Next i </code></pre> <p>This will loop through all attributes and display it in a MSGBOX in a <code>name=value</code> format.</p> <p>If you want to retreive it by name (attributes name) just call using <code>aElement.getAttribute("target")</code> to retreive the target attributes value from the a Link.</p> <p>If you want to confirm you got the right object/element, just do a <code>aElement.outerHTML</code> to get the full HTML code for that element only.</p> <p>Since I am using a pre.NET version, feel free to change the declaration from HTMLAnchorElement to IHTMLAnchorElement if it gives you trouble, of course, you can just use IHTMLElement if you want to go through all elements on a page, then all you'll need to do is wbMain.Document.All(0) for first element on a page, or loop until .All.length - 1 to go through all. Remember if you are using nested For loops, don't use i twice, use j for one of them :).</p> <p>Let me know if this answers your question or if there is more I can do to help you with your issue.</p>
    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.
    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