ajetrumpet
Banned
- Local time
- Today, 17:35
- Joined
- Jun 22, 2007
- Messages
- 5,627
I have written this function to automate a Craig's List login:
The function works fine without incident, but the submit (log in) button is never clicked through the code. Here is relevant portion of the page's HTML through google's Chrome Browser:
The code in RED is where I think the name of the button should be. As you see in the code, the Email and Password text boxes are named inputEmailHandle and inputPassword, respectively. As you can also see, there is no "NAME" property for the "submit" button element. Am I missing something? How do I get the name of the button? It seems to be missing from the code. Am I correct in this?
The bottom line here is that I am completely automating this process if I can get this one simple problem fixed. Thanks for any help!
addition
As a test, I ran this loop inside the procedure:
Nothing printed in the immediate window. Not even an empty line. So, this makes me think that the button has no name. If so, how do I click it? Thank you!
Code:
Function Login()
On Error Resume Next
Dim ie As Object
Dim document, element
Set ie = CreateObject("internetexplorer.application")
ie.navigate "https://accounts.craigslist.org/"
ie.Visible = True
While ie.busy
DoEvents
Wend
ie.document.all("inputEmailHandle").Value = "myemail"
ie.document.all("inputPassword").Value = "mypassword"
[COLOR="Red"]ie.document.all("submit").Click[/COLOR]
While ie.busy
DoEvents
Wend
End Function
Code:
<td align="right"><b>Email / Handle:</b></td>
<td><input type="text" name="inputEmailHandle" value="" size="40" maxlength="64" tabindex="1"></td>
</tr>
<tr>
<td align="right"><b>Password:</b></td>
<td><input type="password" name="inputPassword" size="10" maxlength="40" tabindex="1" AUTOCOMPLETE="off"></td>
</tr>
<tr>
<td> </td>
<td>[COLOR="Red"]<input type="submit" value="Log In" tabindex="1"><font size="-1"[/COLOR]
The bottom line here is that I am completely automating this process if I can get this one simple problem fixed. Thanks for any help!
addition
As a test, I ran this loop inside the procedure:
Code:
For Each element In ie.document.all
If element.InputType = "submit" Then
Debug.Print element.Name
End If
Next element
Last edited: