Reputation: 65
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.
Upvotes: 0
Views: 2062
Reputation: 2306
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.
Upvotes: 1