none
How to click a link using webclient?

    Question

  • I'm having problems on clicking (as i don't know where to start) on a content (image or text) inside a tag (as for example a link tag) on a page. If someone can explain to me how it would work with text, i could figure out on my own how to click an image.

    Thanks in advance for your help.

     

    I need to actually click it as a Javscript code is supposed to run, downloading the html source and reading the links is not what i am looking for.

     

    Regards,

    Zananok


    Darksunlight Productions (http://www.darksunlight.com/)
    Monday, February 07, 2011 10:27 AM

Answers

  • Sadly there isn't. The Javascript engine in the browser does this and has been decades in development in order to achieve it. 

    The easiest thing might be to record a session from the browser with something like fiddler, then write the code to make the same requests. This assumes that the requests are the same each time. 

    If there is dynamic content then you would been to parse the responses each time and work out the dynamic stuff that needs to be inserted in the next request.

    Running the javascript on the page is something the browser can do for you. 


    HTH Ciaran http://www.wannabedeveloper.com
    • Proposed as answer by Balaji Baskar Tuesday, February 08, 2011 9:01 PM
    • Marked as answer by Zananok Thursday, February 10, 2011 12:35 PM
    Tuesday, February 08, 2011 7:20 PM

All replies

  • The WebClient class provides common methods for sending data to or receiving data from any local, intranet, or Internet resource identified by a URI.

     

    Are you referring to WebBrowser here? Maybe you could explain what you are exactly trying to achieve?


    Life would have been much easier if I had the source-code !!
    Monday, February 07, 2011 8:40 PM
  • No, I really mean the WebClient; I am working on a php/ajax test code where I want my program to activate it by clicking on it.

    I understand that it receives and sends data, however, i expected there should be a way of activating some javascript (ajax) content on my page without the help of a WebBrowser object. I can do it with the WebBrowser, but I am looking on achieving the same thing through the WebClient, problem is that even if i made a javascript engine myself, i would have the problem that the javascript code cannot be linked to an external .js file as it is. So I assume (or rather, I hope) there is a simple and effective way of activating javascript (ajax) contents in a page by clicking either text or an image by using WebClient.

     

    And by clicking, of course, i mean send the data that is sent of a click since its not a WebBrowser like object.

     

    Appreciated the reply.

     

    Regards,

    Zananok


    Darksunlight Productions (http://www.darksunlight.com/)
    Tuesday, February 08, 2011 5:10 PM
  • Sadly there isn't. The Javascript engine in the browser does this and has been decades in development in order to achieve it. 

    The easiest thing might be to record a session from the browser with something like fiddler, then write the code to make the same requests. This assumes that the requests are the same each time. 

    If there is dynamic content then you would been to parse the responses each time and work out the dynamic stuff that needs to be inserted in the next request.

    Running the javascript on the page is something the browser can do for you. 


    HTH Ciaran http://www.wannabedeveloper.com
    • Proposed as answer by Balaji Baskar Tuesday, February 08, 2011 9:01 PM
    • Marked as answer by Zananok Thursday, February 10, 2011 12:35 PM
    Tuesday, February 08, 2011 7:20 PM
  • Thanks, I did not know that fiddler could provide me the code request. (Its a static request)

     

    Regards,

    Zananok


    Darksunlight Productions (http://www.darksunlight.com/)
    Thursday, February 10, 2011 12:36 PM