Results 1 to 16 of 16

Thread: logging on to web

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2003
    Location
    Sydney
    Posts
    107

    logging on to web

    hi I am trying to log on to a web page through my program using this code:

    Private Sub Command1_Click()

    'WebBrowser1.Navigate
    WebBrowser1.Navigate ("http://www.mysite.com/")
    Do Until WebBrowser1.ReadyState = READYSTATE_COMPLETE
    DoEvents
    Loop
    WebBrowser1.Document.Forms(0).uname.Value = Text1.Text
    WebBrowser1.Document.Forms(0).uemail.Value = Text2.Text
    WebBrowser1.Document.Forms(0).psword.Value = Text3.Text
    WebBrowser1.Document.Form(0).submit

    End Sub

    but I am getting error at this line: WebBrowser1.Document.Form(0).submit

    it just wont submit, the ollowing code is from the we page source:
    <td align="center"><font color="black">Username:</font></td>
    </tr>
    <tr>
    <td align="center"><input class="login_input" type="text" name="uname" value=""></td>
    </tr>
    <tr>
    <td align="center"><font color="black">Email:</font></td>
    </tr>
    <tr>
    <td align="center"><input class="login_input" type="text" name="uemail" value=""></td>
    </tr>
    <tr>
    <td align="center"><font color="black">Password:</font></td>
    </tr>
    <tr>
    <td align="center"><input class="login_input" type="password" name="psword"></td>
    </tr>
    <tr>
    <td align="center" style="padding-top: 5px;"><input class="login_input" type="submit" value="Login" style="width: 50px;"></td>
    </tr>
    </table>
    <input type="hidden" name="hash" value="e97be0c74dd6e21be069e57c7fe40c9a">
    Thnx In Advance

  2. #2
    Hyperactive Member
    Join Date
    Nov 2002
    Location
    Someplace 'ore the rainbow
    Posts
    392
    Don't know how much this will help but:
    I noticed on the submit line of code its "Form(0)" whereas the other lines have "Forms (0)". Is this is perhaps?

    cjqp

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2003
    Location
    Sydney
    Posts
    107

    logging on to web solved

    perhaps, cjqp ? nope u are correct, it is that!!!
    thanks for pointing it out!! its the little things we miss and believe me I went over it how many times and still couldn't see it :-)
    Thnx In Advance

  4. #4
    Hyperactive Member
    Join Date
    Nov 2002
    Location
    Someplace 'ore the rainbow
    Posts
    392

    Post

    Your welcome
    Reason I said perhaps is because I havn't done much with the Webbrowser control..and nothing like munipulaing forms...And yes, little things are hard to miss, especially when we think we've coded it right even when it complains.

    cjqp

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Feb 2003
    Location
    Sydney
    Posts
    107
    actually I still do have a problem,
    It logs on to the site correctly now, but once logged on it loops and tries to log on again which produces an error.
    Thnx In Advance

  6. #6
    Hyperactive Member
    Join Date
    Nov 2002
    Location
    Someplace 'ore the rainbow
    Posts
    392
    I don't see why it would do that...but try this:

    VB Code:
    1. Dim hasLogged As Boolean
    2. hasLogged = False
    3. Do While hasLogged = False
    4.  'WebBrowser1.Navigate
    5.  WebBrowser1.Navigate ("http://www.mysite.com/")
    6.  Do Until WebBrowser1.ReadyState = READYSTATE_COMPLETE
    7.   DoEvents
    8.  Loop
    9.  WebBrowser1.Document.Forms(0).uname.Value = Text1.Text
    10.  WebBrowser1.Document.Forms(0).uemail.Value = Text2.Text
    11.  WebBrowser1.Document.Forms(0).psword.Value = Text3.Text
    12.  WebBrowser1.Document.Form(0).submit
    13.  hasLogged = True
    14. Loop
    Not the most efficient but if it loops because of this sub this should stop it.

    cjqp

  7. #7
    Lively Member Julie_Luvs's Avatar
    Join Date
    Apr 2004
    Location
    Paradise
    Posts
    83
    i tryed doing this but i get this error


    Run-time error '438':
    Object doesn't support this property or method
    and it highlights this line below:
    WebBrowser1.Document.Form(0).submit



    may someone help me on this?
    Julie Luvs


  8. #8
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    Try using Forms with an s at the end.
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

  9. #9
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    Here, like this:

    VB Code:
    1. WebBrowser1.Document.Forms(0).submit
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

  10. #10
    Lively Member Julie_Luvs's Avatar
    Join Date
    Apr 2004
    Location
    Paradise
    Posts
    83
    same error
    Julie Luvs


  11. #11
    Lively Member Julie_Luvs's Avatar
    Join Date
    Apr 2004
    Location
    Paradise
    Posts
    83
    hm.. its strange becasue it works for mail.yahoo.com, but not the site i want to work on
    Julie Luvs


  12. #12
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    Yeah, it works for me too... Strange.

    I don't know the reason. Sorry
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

  13. #13
    Lively Member Julie_Luvs's Avatar
    Join Date
    Apr 2004
    Location
    Paradise
    Posts
    83
    its ok thank you for helping me tho
    Julie Luvs


  14. #14
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    You are welcome
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

  15. #15
    Lively Member Julie_Luvs's Avatar
    Join Date
    Apr 2004
    Location
    Paradise
    Posts
    83

    Lightbulb

    scince i cant use the submit button, how can i put a focus on the submit button and hit the "enter" key instead?
    Julie Luvs


  16. #16
    New Member
    Join Date
    Apr 2004
    Location
    Massachusetts, USA
    Posts
    2
    did you try adding the action to the submit?
    VB Code:
    1. WebBrowser1.Document.Forms(0).uname.Value = Text1.Text
    2.  WebBrowser1.Document.Forms(0).uemail.Value = Text2.Text
    3.  WebBrowser1.Document.Forms(0).psword.Value = Text2.Text
    4.  WebBrowser1.Document.Forms(0).submit.Click
    Last edited by memikeos; May 5th, 2004 at 07:24 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