Results 1 to 40 of 531

Thread: Manipulate/Change/Form Fill data in webpages using the Webbrowser control

Threaded View

  1. #1

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Manipulate/Change/Form Fill data in webpages using the Webbrowser control

    All the time I see people asking how to autofill in forms on webpages or how to click a button in a webpage that is hosted in the webbrowser control, via VB code.

    It is really not all that difficult, once you get around the casting of types to the correct kind when using the COM reference.

    This example project highlights the following manipulations (as well as opening the door to manipulate just about anything on a webpage that is possible)

    * Getting a value of an HTML input element
    * Setting a value of a HTML input element
    * Getting a value of an HTML text area
    * Setting a value of a HTML text area
    * Set HTML radio buttons selected or not
    * Click an HTML button
    * Submit an HTML Form
    * Get the sources for all images in HTML document
    * Get and display all the links in the HTML document
    * Alter non form elements (like changing the color of a DIV tag)
    * Getting values from an HTML Select element (value and selected index)
    * Display page HTML source
    * Run a javascript that is in the HTML Page
    * click a checkbox in an HTML form
    * Print the current page (with printer selection dialog)
    * Added 8/24/2006 - Highlight webpage text via code

    This specific example code is done using

    Visual Studio 2005 (VB.NET)
    However I use the COM WB Control, not the built in .NET 2.0 WB Control (because its functionality is rather limited)
    I also use a reference to the MSHTML scripting engine, which is what allows you to parse a webpage into all its elements so you can manipulate them.


    Please let me know if you have any questions/comments/suggestions.

    I can add more functionality examples if someone can think of one....
    Attached Files Attached Files
    Last edited by kleinma; Aug 24th, 2006 at 10:05 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width