Results 1 to 2 of 2

Thread: Login with webbrowser Problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2010
    Posts
    1

    Login with webbrowser Problem

    Good evening together.

    I want to log on the web page on http://108.hosttech.ch/user/index.php
    the web browser. This is usually not a problem but I can not get the login button automatically vers / click

    So far I have this;

    Code:
    WebBrowser1.Document.All ("user name"). SetAttribute ("value", "***********")
            WebBrowser1.Document.All ("password"). SetAttribute ("value", "************")
            WebBrowser1.Document.GetElementById ("?? Name ??"). InvokeMember (" click ")

    Thanks for the help

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,416

    Re: Login with webbrowser Problem

    try this:

    vb Code:
    1. Public Class Form1
    2.  
    3.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    4.         WebBrowser1.Navigate("http://108.hosttech.ch/user/index.php")
    5.     End Sub
    6.  
    7.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    8.  
    9.         WebBrowser1.Document.All.GetElementsByName("username")(0).SetAttribute("value", "username")
    10.         WebBrowser1.Document.All.GetElementsByName("password")(0).SetAttribute("value", "password")
    11.  
    12.         For Each element As HtmlElement In WebBrowser1.Document.GetElementsByTagName("a")
    13.             If element.GetAttribute("className") = "button-1" Then
    14.                 element.InvokeMember("click")
    15.                 Return
    16.             End If
    17.         Next
    18.  
    19.     End Sub
    20.  
    21. End Class

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