1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Automated Form filling in C# via WebBrowser control or similar.

Discussion in 'C, C++, C#' started by JOBGG, Jan 3, 2013.

  1. JOBGG

    JOBGG Newbie

    Oct 19, 2012
    Likes Received:
    I'm trying to write a little program in order to semi-automate form filling, and I have a rough idea on how I can do it with the WebBrowser control. Now I want to show the site whilst the filling is done, and here my understanding breaks down. I'm using the GTK# libraries for the GUI, but I have no idea how to render the WebBrowser control as a GTK# widget. I'm pretty sure there has to be an easy way to do this, since now way people are writing their own rendering script for using internet explorer, but I've been too stupid to find it. I'd greatly appreciate help on this.
  2. ultra.marine

    ultra.marine Registered Member

    Oct 5, 2012
    Likes Received:
    If I am not wrong I saw something like that in the section here.... It was full example how to automate form filling or so....

    Hmmm by what I understood, I think there is Webbrowser control, or object ... or how do you call it.

    So first you navigate to the page, once navigation is done [use webdocument loaded and webbrowser.readystate=readystat.completed inside the event] you should start filling the forms, you can do that by ID or by tagName

    'by id will be something like this
    'if the element doesn't have id then try this
    Dim htmldoc as htmlelement
    Dim htmldoccol as htmlelementcollection=webbrowser1.document.getelementsbytagname("input")
    'loop through each of the inputs, do some tests, print logs somewhere so you can see how many elements you have and nail down the one you need
    for each htmldoc in htmldoccol
    if htmldoc.outterhtml.tostring.contains("years") and htmldoc.outterhtml.tostring.contains("something else")
    'we found our elements
    exit for
    end if
    And sorry some may be spelled wrong or idk, just trying to help
    Sorry about the vb.net i missed the section, though it can easily be converted to c#
    • Thanks Thanks x 1
    Last edited: Jan 4, 2013