Results 1 to 6 of 6

Thread: [RESOLVED] Login to a webpage

  1. #1

    Thread Starter
    Addicted Member sinner0636's Avatar
    Join Date
    Sep 2009
    Posts
    233

    Resolved [RESOLVED] Login to a webpage

    Hello im a bit new with vb programming

    i was wondering how i can login to a webpage with a button that has no id just a name

    Code:
     <button name="loginBtn" type="submit" class="glue primary">Login</button></p>
            
           <div id="SMSVerifyObj"></div>
      </fieldset>
    </form>
    
    <iframe id="loginIframe" name="loginIframe"></iframe>
    heres what i have so far it adds my email and name to the webpage just need to make it click the login button on the page

    Code:
    Form1.WebBrowser1.Document.All("emailSplash").Value = "myemail"
    Form1.WebBrowser1.Document.All("passwordSplash").Value = "mypassword"
    
    this the name of the button not working any ideas?
    Form1.WebBrowser1.Document.All("loginBtn").submit

  2. #2
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Login to a webpage

    Can you post the weblink?

    Sid
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Login to a webpage

    you click the button or submit the form
    try
    Form1.WebBrowser1.Document.All("loginBtn").click

    or find the form name (not form1) or index to submit it
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  4. #4
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: Login to a webpage

    could you please give a link to the site, or the whole form code?

  5. #5

    Thread Starter
    Addicted Member sinner0636's Avatar
    Join Date
    Sep 2009
    Posts
    233

    Re: Login to a new myspace

    Quote Originally Posted by Justa Lol View Post
    could you please give a link to the site, or the whole form code?
    it the new myspace update login

    got the code working heres the code for clicking a button with no id

    Code:
    If Form1.WebBrowser1.ReadyState = WebBrowserReadyState.complete Then
    Form1.WebBrowser1.Document.All("emailSplash").Value = Email.Text
    Form1.WebBrowser1.Document.All("passwordSplash").Value = Password.Text
    
      Dim oCol As IHTMLElementCollection
       Set oCol = Form1.WebBrowser1.Document.All.tags("BUTTON")
    
       For Each oelement In oCol
           If InStr(oelement.className, "glue primary") > 0 Then
                oelement.Click
           End If
       Next oelement
    End If

  6. #6
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: Login to a webpage

    sorry, i ment the login form, anyways, if your problem has been solved, please mark thread as resolved.

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