Need to auto login to a portal

srihari186

New Member
Joined
Aug 2, 2011
Messages
3
Hi All,

I am new to the portal, need some help in the code where I can login to a user name and password as per the data entered. I am able to enter the values in the fields but not able to login.

Below is the code for reference :

Dim HTMLDoc As HTMLDocument
Dim oBrowser As InternetExplorer
Sub Login_2_Website()

Dim oHTML_Element As IHTMLElement
Dim sURL As String

On Error GoTo Err_Clear
sURL = "https://jobs8.netmedia1.com/jobs/cmm/"

'If Not CheckInetConnection(sURL) Then MsgBox "GOM cannot be reached. Please check your network connection or GOM may be down at this time", vbInformation, Msgcaption: GoTo NoDo
Set oBrowser = New InternetExplorer
'oBrowser.Silent = True
'oBrowser.timeout = 60
oBrowser.navigate sURL
oBrowser.Visible = True

Do
' Wait till the Browser is loaded
Loop Until oBrowser.readyState = READYSTATE_COMPLETE

Set HTMLDoc = oBrowser.Document

If ActiveWorkbook.Sheets(2).Range("A1").Value = "" And ActiveWorkbook.Sheets(2).Range("A2").Value = "" Then
MsgBox "User or Password not entered", vbQuestion
Else
HTMLDoc.all.user_id.Value = ActiveWorkbook.Sheets(2).Range("A1").Value
HTMLDoc.all.Password.Value = ActiveWorkbook.Sheets(2).Range("A2").Value
End If
For Each oHTML_Element In HTMLDoc.getElementsByTagName("input id")
If oHTML_Element.Type = "login" Then oHTML_Element.Click: Exit For
Next

' oBrowser.Refresh ' Refresh If Needed
Err_Clear:
If Err <> 0 Then
On Error Resume Next
Debug.Assert Err = 0
Err.Clear
Resume Next
End If
End Sub

when i enter the user name and password, not able to click on login button and proceed further.

Please help!!!

Thanks
Srihari
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
How is clicking the submit button not working?
 
Upvote 0
Its not the submit button, in fact after entering the values in the user name and password field, its not logging into next page.
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,834
Members
452,947
Latest member
Gerry_F

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