-
February 28th, 2010, 08:46 AM
#1
Help clicking login button on a webpage
I am having trouble getting my form to click the login button on a website. I can get my username and password to load into the sites text boxes but I auto click the button . I have been trying different code for weeks and I have let that button whoop-me. Please Help. This is my main form and my code as of now.
>Private Sub lblPass_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub btnGet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGet.Click
login1.ShowDialog()
End Sub
Private Sub txtUser_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub SwaggerLee1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.Navigate(ComboBox1.Text)
System.Threading.Thread.Sleep(4000) ' Delay 4 seconds to render login
End Sub
Private Sub lblUser_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblUser.Click
End Sub
Private username, password As String
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
Login(username, password)
End Sub
Private Sub Login(ByVal username As String, ByVal password As String)
Dim theWElementCollection As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("Input")
For Each curElement As HtmlElement In theWElementCollection
Dim controlName As String = curElement.GetAttribute("id").ToString
If controlName = "emailAddressLocal" Then
curElement.SetAttribute("Value", lblUser.Text)
ElseIf controlName = "pswdLocal" Then
curElement.SetAttribute("Value", lblPass.Text)
End If
Next
End Sub<
The Get Elements By Id Method I've been using to click the Button doesn't work at all, Please Help.
Here is the Source Code for that Button.
<form name="frmLogIn-tbar" id="signInBoxLocal" method="post" action="/?cmd=sb- login&from=/?cmd=home">
<label class="loginLabel">Email Address or Swag Name:</label>
<input class="secBorder" title="Enter your email address" type="text" name="emailAddress" id="emailAddressLocal" onKeyPress="return enterLoginTBLocal(event);" tabindex="1"/>
<a href="#" onClick="sendEmailTBLocal(); return false" class="emailPass highlight1">Forgot Password?</a>
<label class="loginLabel">Password:</label>
<input class="secBorder" title="Enter your password" type="password" name="pswd" id="pswdLocal" onKeyPress="return enterLoginTBLocal(event);" tabindex="2"/>
<div class="btn1 btnLogin" onclick="logInTBLocal();">Login</div>
<div class="persist">
<input class="persist" type="checkbox" name="persist" id="persistLocal" checked onKeyPress="return enterLoginTBLocal(event);" onchange="prettyCheckbox('persist',this)" tabindex="3"/>
<label class="persist" for="persistLocal" class="persistLabel">Remember Me</label>
<div class="clear"></div>
Please Help!
-
February 28th, 2010, 06:53 PM
#2
Re: Help clicking login button on a webpage
Find the button, and call .Submit
-
February 28th, 2010, 08:25 PM
#3
Re: Help clicking login button on a webpage
I've Been over the entire Source Code for this webpage. There is no "Id" or "Name" for the Login Button in the source code. Here is the only reference to It that I could find.
<div class="btn1 btnLogin" onclick="logInTBLocal();">Login</div>
Any Suggestions?
-
February 28th, 2010, 10:44 PM
#4
Re: Help clicking login button on a webpage
Can't help automating login, sorry. See the AUP at the bottom of every page here
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|