1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to Simulate User Opening Brower and Clicking Link

Discussion in 'General Programming Chat' started by iamblackhat, Nov 10, 2008.

  1. iamblackhat

    iamblackhat Registered Member

    Joined:
    Feb 6, 2008
    Messages:
    62
    Likes Received:
    9
    I want to create a simple application that opens a browser and click on a link. I'm interested in doing this in C#. Is this possible to do?

    If so, how is it done.
     
  2. scubaslick

    scubaslick Regular Member

    Joined:
    Aug 23, 2007
    Messages:
    392
    Likes Received:
    512
    Yes, it's possible.

    Here's a good start on simple browser creation. The clicking is a bit more involved, but c# is a very accessible language with a mountain of support material and learning resources available, so you should be able to work out the basics within a couple of days.

    If you're planning on clicking your own ads, this isn't the way to go however. Building a browser and a clicker macro is easy: hiding your tracks is hard.

    If that's not what you had in mind, give it a shot. Or give it a shot anyway, just be prepared to learn some lessons the hard way. :)

    Code:
    http://msdn.microsoft.com/en-us/library/ms379558(VS.80).aspx
     
  3. chachinga

    chachinga Guest

    Very easy to do with vb and webrowser control. You can pretty much fake any user interaction with it.
     
  4. crepito

    crepito Junior Member

    Joined:
    Oct 5, 2008
    Messages:
    145
    Likes Received:
    28
    Location:
    Portugal
    I think what you wanna do is create a tool that will fire up your browser, fill the url address and click on the "Go" button right?

    If that's what you wanna do, its not easy. Correct me if i'm wrong but i think you will have to learn how to manipulate external application windows within your tool, working with processes and so on. Not an easy task.

    Just a quick sample on how to start/close an external application within a C# App
    Code:
    Process note = Process.Start("notepad.exe");
    note.CloseMainWindow();
    note.Waitforexit(); 
    note.Close(); 
    
    Dunno if this is the correct syntax but its something similar.
    
     
  5. iamblackhat

    iamblackhat Registered Member

    Joined:
    Feb 6, 2008
    Messages:
    62
    Likes Received:
    9
    What I want is the program to visit a homepage, then click on a link so it takes you to page A. That way, page A is referred by the homepage. I want the referrer to show up in the visitor logs. That's why it's necessary to simulate the clicking of the link instead of actually going to the link directly.
     
  6. crepito

    crepito Junior Member

    Joined:
    Oct 5, 2008
    Messages:
    145
    Likes Received:
    28
    Location:
    Portugal
    If the first page is always the same its easy to do. Personally i use mshtml, as reference, to parse information and submit data into forms and click buttons but, i think, you can use the webbrowser component, by itself, to do that. You can find lots of examples in the internet. The proxy support is the hardest part for what you wanna do. But again with some google searches you might be able to solve the problem.