Inserting user ID and password

ian0886

New Member
Joined
Dec 10, 2016
Messages
42
Hi Guys,

I've been trying to auto certain processes and i'm trying to automatically login to a certain website. Below is my VBA code and the java script of the website. Until the line when its suppose to insert the userid and password, an error appeared. Appreciate any advise


HTML:
<form id="login-form" name="login-form" action="/client-portal-admin/j_spring_security_check" method="POST">			<div class="control-group">				<label for="j_username" class="control-label">User id:</label> <input type="text" name="j_username" placeholder="User id" maxlength="100" required />			</div>			<div class="control-group">				<label for="j_password" class="control-label">Password:</label> <input type="password" name="j_password" placeholder="********" maxlength="100" required />			</div>			<div class="control-group">				<button type="submit" class="btn btn-orange"><i class="icon-lock icon-white"></i> Login</button>			</div>		</form>

Code:
 Sub CP()
  Set ie = CreateObject("InternetExplorer.Application")
  my_url3 = "website"
      
    With ie
        .Visible = True
        .Navigate my_url3
    
    Do Until Not ie.Busy And ie.readyState = 4
    DoEvents
    Loop
    End With
    Application.Wait (Now + TimeValue("0.00:03"))
    
    On Error Resume Next
    ie.document.getElementsByName("overridelink").Item.Click
    On Error GoTo 0
    
    Application.Wait (Now + TimeValue("0.00:05"))
    
    ie.document.getElementByClassName("text").Value = "xyz"
    ie.document.getElementByClassName("password").Value = "123"

End Sub



Thanks!
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Try

Code:
ie.document.getElementByName("[COLOR=#0000FF]j_username[/COLOR]").Value = "xyz"
ie.document.getElementByName("[COLOR=#0000FF]j_password[/COLOR]").Value = "123"
 
Upvote 0
Rich (BB code):
    ie.Document.getElementsByName("j_username")(0).Value = "xyz"
    ie.Document.getElementsByName("j_password")(0).Value = "123"
 
Upvote 0

Forum statistics

Threads
1,223,099
Messages
6,170,112
Members
452,302
Latest member
TaMere

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top