Clicking a random link out of all the page links in a webbrowser, vb.net
Im Trying to click on a random link in a webbrowser page. I have this code so far but i  get an error "Object reference not set to an instance of an object." Any help would be great.


    If WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then
                Dim links As String
                Dim count As String
                links = WebBrowser1.Document.Links.Count
                count = RandomNumber(links, 0)
                WebBrowser1.Document.Links.Item(count).InvokeMember("click")
        End If
Clicking a random link out of all the page links in a webbrowser, vb.net
===

Im Trying to click on a random link in a webbrowser page. I have this code so far but i  get an error "Object reference not set to an instance of an object." Any help would be great.


    If WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then
                Dim links As String
                Dim count As String
                links = WebBrowser1.Document.Links.Count
                count = RandomNumber(links, 0)
                WebBrowser1.Document.Links.Item(count).InvokeMember("click")
        End If