Interact with a web site with a WebBrowser object RRS feed

  • Question

  • Hi,

    I am trying to check the response from a website with a WebBrowser object.

    I have a Winform, which contains a webbrowser.

    Starting the winform in my code, I can navigate to the site and see it's contents. I can locate the input fields, set their values and submit the "Submit" button.

    In response to my request, the site adds a text onto the page that says "Approved" or "Not approved". I want to capture that text.

    I am testing the Document object (of the WebBrowser) and see no difference… I cannot locate the htmlElement which contains the response (Approved/Not approved) from the site !

    1) Why is that ?

    2) How may I retrieve the site's response ?

    Thanks a lot !

    Wednesday, August 22, 2018 12:21 PM

All replies

  • Using Chome Browser, right click on the text and select inspect element. If the element has a id then you can search for it that way. If no id then you need to search for (considering it's an input) all inputs, check for value containing approved.

    Somehow the site is appending to the DOM so there must be a element to represent the text.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Wednesday, August 22, 2018 1:40 PM
  • Thank you Karen,

    Yes, when viewing manually the source page, I can see that the site has added one element at the very end of the document:

    <font color="red"><p>Approved.</p></font>


    But I'm unable to see it through code !!

            Dim s As String = String.Empty
            For Each ht As HtmlElement In wb.Document.All
                s &= ht.OuterHtml
    I don't see the "Approved" string !!

    Wednesday, August 22, 2018 3:44 PM
  • I gave up doing this with a webbrowser object.

    I managed to do it with a HttpWebRequest and HttpWebResponse, which worked fine.

    Thanks for your help.

    Wednesday, August 22, 2018 5:11 PM
  • Hi,

    I am glad you have got your solution, we appreciated you shared us your solution and mark it as an answer.

    Best Regards,


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Thursday, August 23, 2018 2:18 AM