Use WebBrowser to submit data
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Use WebBrowser to submit data

  1. #1
    Join Date
    Jan 2011
    Posts
    25

    Use WebBrowser to submit data

    Hey,

    I am trying to submit data using the vb6 webbrowser control.
    In the case of google it is quite easy:
    Right click the textbox and select inspect element which reveals the textbox name to be "q"
    Right click the google submit button which reveals the button's name to be "btnG"

    So the code to submit data to the google search engine is:
    Code:
    WebBrowser1.Document.All("q").focus
    WebBrowser1.Document.All("q").Value = "Enter the Search Lookup"
    WebBrowser1.Document.All("btnG").focus
    WebBrowser1.Document.activeElement.Click
    However, it is not always that easy. For example, how to submit a reply to this site?

    I tried:
    WebBrowser1.Document.All("quick_reply").focus
    WebBrowser1.Document.All("quick_reply").Value = "A Reply"
    However, setting the value that way didn't work.

    Same when I tried using:
    WebBrowser1.Document.getElementById("cke_contents_vB_Editor_QR_editor").value

    Error in both cases: 'Object does not support this property or method'

    Although submitting a reply is easy:
    Code:
    WebBrowser1.Document.All("sButton").focus
    WebBrowser1.Document.activeElement.Click
    Last edited by Witis; May 17th, 2014 at 06:57 PM.

  2. #2
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,984

    Re: Use WebBrowser to submit data

    Most sites require both a POST and the need for a cookie. Additionally, ASP pages can't really be accessed from the client side.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jan 2011
    Posts
    25

    Re: Use WebBrowser to submit data

    Quote Originally Posted by dglienna View Post
    Most sites require both a POST and the need for a cookie. Additionally, ASP pages can't really be accessed from the client side.
    Thanks for the reply dglienna, what do you mean by POST?

  4. #4
    Join Date
    Jan 2011
    Posts
    25

    Re: Use WebBrowser to submit data

    I found that I could get the value in the quick reply section using this code:
    Code:
    WebBrowser1.Document.All("message_backup").focus
    Debug.Print WebBrowser1.Document.All("message_backup").Value
    Although setting it like so:
    WebBrowser1.Document.All("message_backup").Value = "12345"
    Debug.Print WebBrowser1.Document.All("message_backup").Value
    Didn't change the reply.

    I wonder why?

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center