Results 1 to 5 of 5

Thread: Help Needed about WebBrowser.document Method

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2009
    Posts
    66

    Help Needed about WebBrowser.document Method

    I've Created an automation in IE by webbrowser Controller.
    Now in one page I have this Html code:

    HTML Code:
    <DIV class=sendpost-start>
    <DIV class=sendpost-core_large>
    <P class=padded>Subject</P><INPUT class="text padded" id=message_subject 
    name=message_subject>
    <P class=padded>Message</P><TEXTAREA class="textarea padded" id=message_body name=message_body></TEXTAREA><SPAN 
    class=invalid-small id=error_for_message_body style="DISPLAY: none"></SPAN> 
    <SPAN class=twin-small id=error_for_message_body_twin 
    style="FLOAT: left"></SPAN><INPUT id=recaptcha_response_field type=hidden 
    value=1 name=recaptcha_response_field><INPUT class=submit type=submit value=Send name=commit>
    <DIV class=sendpost-end></DIV></DIV></DIV></FORM></DIV></DIV>
    <DIV id=promo><IFRAME id=eads src="Send PM_files/1715807.htm" frameBorder=0 
    width=120 scrolling=no height=1000>
    </IFRAME></DIV>
    how can I click on commit and send some data?
    this is a compose mail page that I can fill the message body and message subject fields by these codes:
    Code:
            Web.Document.All.Item("citizen_name").Value = C_Name
            Web.Document.All.Item("citizen_password").Value = C_PW
    I Tried to click on send button by this:
    Code:
            Web.Document.All.Item("commit").Click
    Did not worked.

    Pleaseeeeeeeeeeeeeeeeeee!!!!!
    May Someone give me some tutorial or anything else on web.document method to find out how to solve these problem?

  2. #2
    Addicted Member ZenDisaster's Avatar
    Join Date
    Dec 2006
    Location
    Bay Area, CA
    Posts
    140

    Re: Help Needed about WebBrowser.document Method

    Code:
                For Each MyButton As mshtml.HTMLButtonElement In Web.Document.getElementsByName(commit)
                    MyButton.click()
                    Return
                Next MyButton
    If you're a fan of one-liners, the following code will click the first element whose name property matches "commit";

    Code:
    Web.Document.getElementsByName("commit").item(0).Click()
    Last edited by ZenDisaster; Aug 4th, 2009 at 12:53 AM.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2009
    Posts
    66

    Re: Help Needed about WebBrowser.document Method

    Thanks Bro for your reply. +1 Rep for your help.

    But second code that I like to use didn't work and I did not saw any reaction of my webbrowser after adding that code.

    And in first code after adding a reference (Microsoft HTML Object) I Got this error:
    Code:
    Expected: IN
    I tried to define mybutton in other line as:
    Code:
    Dim mybutoon As MSHTML.HTMLButtonElement
    And I cleared "Return" Command. that did worked.
    But I Know it's not the correct way.
    I Like to use something like second code you gave.
    Any solution?
    Last edited by Amir3D; Aug 4th, 2009 at 03:13 PM.

  4. #4
    Addicted Member ZenDisaster's Avatar
    Join Date
    Dec 2006
    Location
    Bay Area, CA
    Posts
    140

    Re: Help Needed about WebBrowser.document Method

    Ok so the button you want to click probably isn't the first instance. Try item(1) instead of 0.

  5. #5
    Addicted Member ZenDisaster's Avatar
    Join Date
    Dec 2006
    Location
    Bay Area, CA
    Posts
    140

    Re: Help Needed about WebBrowser.document Method

    Also, looks like I forgot the quotes around commit in the first section.

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