0

I would like to code for opening a browser window whichever is default and navigate to a website make a click on a image. i tried too many google search but since i am extreme newbie to c# i couldn't achieve the result. i want to make a textbox too with a timer which display a mouse position to give in x,y coordinate to make a mouse click.

Here is the code i tried.

var ie = (SHDocVw.WebBrowser)Activator.CreateInstance(Type.GetTypeFromProgID("InternetExplorer.Application"));
        ie.Visible = false; //for testing purpose i will make it visible.
        ie.Navigate("http://www.google.com");

        Location.X = Cursor.Position.X;
        Location.Y = Cursor.Position.Y;

        Console.WriteLine("x: " + Cursor.Position.X + " y: " + Cursor.Position.Y);

Please help me.

MegRay
  • 65
  • 9
  • Do you need to detect when they're entering a password too?... Whats wrong with the code you're showing here? – Sayse Jan 16 '16 at 13:25
  • Error CS0103 The name 'Location' does not exist in the current context Error CS0012 The type 'Point' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. – MegRay Jan 16 '16 at 13:29

1 Answers1

1

In .net you have the webBrowser control https://msdn.microsoft.com/en-us/library/w290k23d(v=vs.110).aspx

all you need to do is create an instance of that control, make it invisible (or size 0)

and navigate using the API: https://msdn.microsoft.com/en-us/library/w6t65c4y(v=vs.110).aspx

once you navigated you are able to query the document and to even invoke clicks InvokeMember("click") in WebBrowser control

Hope this helps.

Community
  • 1
  • 1
Saar
  • 2,276
  • 1
  • 16
  • 14
  • webBrowser1.Navigate("url"); what to intialize webBrowser1 with? How to click on a specific coordinate? – MegRay Jan 16 '16 at 15:17