b.hill2387
New Member
- Joined
- Mar 28, 2012
- Messages
- 38
The code below works for selecting the checkbox when I am already logged in (in this scenario the log in screen never shows up when a new ie is created), but when I am not logged in the code works for logging me in, but then will not select the checkbox once logged in. In both scenarios I am having trouble clicking submit after selecting the checkbox. Can anyone help me fix either of these two issues? Thank you in advance.
Note: The submit button only becomes available to click after a checkbox is selected.
I've copied the source code below for the checkbox and the submit button.
Checkbox:
Submit button:
Note: The submit button only becomes available to click after a checkbox is selected.
HTML:
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 = "**************"
Set oBrowser = New InternetExplorer
oBrowser.Silent = True
oBrowser.timeout = 60
oBrowser.navigate sURL
oBrowser.Visible = True
Do
Loop Until oBrowser.readyState = READYSTATE_COMPLETE
Set HTMLDoc = oBrowser.document
HTMLDoc.all.loginEmail.Value = "*********"
HTMLDoc.all.loginPassword.Value = "******"
For Each oHTML_Element In HTMLDoc.getElementsByTagName("button")
If oHTML_Element.Type = "submit" Then oHTML_Element.Click: Exit For
Next
Err_Clear:
If Err <> 0 Then
Err.Clear
Resume Next
End If
HTMLDoc.all("selected_10").Click
For Each oHTML_Element In HTMLDoc.getElementsByTagName("button")
If oHTML_Element.Type = "submit" Then oHTML_Element.Click: Exit For
Next
If Err <> 0 Then
Err.Clear
Resume Next
End If
End sub
I've copied the source code below for the checkbox and the submit button.
Checkbox:
HTML:
<td class="select"><input id="selected_10" name="selected_10" type="checkbox"></td>
Submit button:
HTML:
<div class="buttonBar">
<button class="btn-continue orange" name="continue" type="submit" value="continue">Continue</button>