title: Visual Basic 19 - WebView2 - Auto click a webpage button
body: <p>I have this old VB web browser that I made to auto log me into my social accounts.
  It would do this by automatically entering my credentials, and clicking &quot;Log In&quot;.
  I enjoyed the privacy of &quot;my own&quot; browser, and I didn't need to remember my passwords.
  However, recently my hard drive failed, and I failed to make a backup...</p>
  <p>I would love to re-create this with the <em>WebView2</em> (Chromium-Edge) package as the default <em>WebBrowser</em> control is having issues now.
  (I understand there are better options for security and storage of passwords, this is just a nostalgic project.)
  However, I'm having trouble converting the code.</p>
  <p>Here's what I can remember basing my code from:</p>
  <pre><code>Dim WebElements As HtmlElementCollection = WebBrowser1.Document.All
  For each PageElement As HtmlElement In WebElements
      If PageElement.GetAttribute(&quot;value&quot;) = &quot;Log In&quot; Then
          PageElement.InvokeMember(&quot;click&quot;)
      End if
  Next
  </code></pre>
  <p>It would be a plus if someone could help me figure out how to auto-fill text fields in <em>WebView2</em> too.</p>