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
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