How to auto click a button on a WebPage

Moreover how to login into the forum without opening a browser

Page 1 of 1

6 Replies - 32683 Views - Last Post: 28 August 2009 - 09:54 PM Rate Topic: -----

#1 sunnydsouza   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 22-August 09

How to auto click a button on a WebPage

Posted 28 August 2009 - 09:39 AM

I need to auto login into a phpBB forum.I tried the following code out but though the username and password fields gets copied nothing else happens.The form doesnt get submitted.

What wrong??

Public Class Form1
	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		WebBrowser1.Navigate("http://www.warez-bb.org/login.php")
	End Sub


	Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
		' WebBrowser1.document.Body.InnerHtml.ToString()

	End Sub


	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		WebBrowser1.document.GetElementById("Username").InnerText = TextBox1.Text
		WebBrowser1.document.GetElementById("Password").InnerText = TextBox2.Text
		WebBrowser1.document.GetElementById("submit").RaiseEvent("onclick")
	End Sub
End Class



Though I am using a webbrowser control at present but I want to remotely login without opening any browser nor a webbrowser control.Now I could hide the webbrowser control but then I wont know whether the site loading operation was successful or not (in case the site was down or so) Is there a function or a value that is returned after successfully loading a website via which I could check (without opening anything) whether my operation was successful or not

Is This A Good Question/Topic? 0
  • +

Replies To: How to auto click a button on a WebPage

#2 ForcedSterilizationsForAll   User is offline

  • D.I.C Addict

Reputation: 33
  • View blog
  • Posts: 506
  • Joined: 16-July 09

Re: How to auto click a button on a WebPage

Posted 28 August 2009 - 01:00 PM

Is this your own forum you're trying to log into, or that of a third party?
Was This Post Helpful? 0
  • +
  • -

#3 sunnydsouza   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 22-August 09

Re: How to auto click a button on a WebPage

Posted 28 August 2009 - 08:54 PM

View PostForcedSterilizationsForAll, on 28 Aug, 2009 - 12:00 PM, said:

Is this your own forum you're trying to log into, or that of a third party?


A third party
Was This Post Helpful? 0
  • +
  • -

#4 Yaroslav94   User is offline

  • D.I.C Regular

Reputation: 5
  • View blog
  • Posts: 294
  • Joined: 15-July 09

Re: How to auto click a button on a WebPage

Posted 28 August 2009 - 09:18 PM

View Postsunnydsouza, on 28 Aug, 2009 - 07:54 PM, said:

View PostForcedSterilizationsForAll, on 28 Aug, 2009 - 12:00 PM, said:

Is this your own forum you're trying to log into, or that of a third party?


A third party

Thanks Me at the bottom If I helped!

U can do it my way:

1 - count how many *tabs it takes for you to reach the username field
2 - count how many *tabs it takes for you to reach the password field from the username field
3 - count how many *tabs it takes for you to reach Log in field from password field
*tabs - I mean a keyboard button Located next to Caps Lock and "`"

then use this code(

SendKeys.Send("{TAB}" & "{TAB}" & "{TAB}" & "username" & "{TAB}" & "password" & "{TAB} & "{ENTER}")
'						  ^			^			 ^								 
'						 Put not three tabs, but as many as there are




Hope I helped!
Was This Post Helpful? 1
  • +
  • -

#5 sunnydsouza   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 22-August 09

Re: How to auto click a button on a WebPage

Posted 28 August 2009 - 09:32 PM

Hmm....that could work though I am in the process of trying it now.But suppose I want to login into multiple forums.Each site's login page will take different number of tabs to reach the "Submit" button......meaning more coding :(

The fact is that the code I posted above should logically work though I dont know where is the problem??


Anyways,it was a brilliant alternate logic ,Yaroslav94


EDIT: Moreover it anyone read the latter part of my post below the code :(

This post has been edited by sunnydsouza: 28 August 2009 - 09:35 PM

Was This Post Helpful? 0
  • +
  • -

#6 Yaroslav94   User is offline

  • D.I.C Regular

Reputation: 5
  • View blog
  • Posts: 294
  • Joined: 15-July 09

Re: How to auto click a button on a WebPage

Posted 28 August 2009 - 09:40 PM

View Postsunnydsouza, on 28 Aug, 2009 - 08:32 PM, said:

Hmm....that could work though I am in the process of trying it now.But suppose I want to login into multiple forums.Each site's login page will take different number of tabs to reach the "Submit" button......meaning more coding :(

The fact is that the code I posted above should logically work though I dont know where is the problem??


Anyways,it was a brilliant alternate logic ,Yaroslav94


EDIT: Moreover it anyone read the latter part of my post below the code :(



For the above code maybe the controls are renamed =P

it could be a simple thing like that, or if the website is using SSL(secure lines)
it won't work ether...lol
Was This Post Helpful? 0
  • +
  • -

#7 sunnydsouza   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 22-August 09

Re: How to auto click a button on a WebPage

Posted 28 August 2009 - 09:54 PM

I ACTUALLY want to make a login form without opening any webbrowser.I mean, a form with only two text boxes and a submit button.When I put in my credentials and press SUBMIT, a simple "Login Successful" or "Login Failed" should appear as a label.Any Logic??

Though I am able to login now (thanks to you) but I am using the webbrowser control.I have seen many application where you can remotely login

Moreover dude,could u head here and try to solve this problem.

http://www.dreamincode.net/forums/showtopic122691.htm

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1