How do I click a javascript button?

Discussion in '.NET' started by d.crozier7, Jun 30, 2012.

  1. d.crozier7

    d.crozier7 Very Active Members

    Joined:
    May 9, 2011
    Messages:
    180
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    U.S.
    I am working on a home project to automate a task so I can improve my time management.


    I am using a web browser control and need to automate the process of clicking a javascript button. I have tried to click the button by it's value but it is not working and I cannot click the button by ID also.

    This is the code of webpage button I need my software to automatically click:
    Code:
    <a href="javascript:void(0);" onclick="viewvideo(7656,'ZYPbX7dNaPw');">Next</a>
    Note that the random looking numbers and letters within the parentheses in the "onclick" part of the code changes every time the page reloads.



    I have tried messing with this code I found on another thread, but with no luck:
    Code:
    WebBrowser1.Document.All("Submit").RaiseEvent("onclick")
    I have been researching this issue for months now on and off when I had the time and am coming to a loss now.


    Any help is very greatly appreciated.


    Thanks in advance,
    David.
     

Share This Page