I need to build a client side application that will load a webpage and automate several tasks, i.e. programmatically trigger the onclick event below and so on.
I've come up with the following code that works well up until I get to the last batch of elements I need to simulate a click on.
Here's the code.
And here's the html that's relevant, it contains AJAX.Code:ListBox1.Items.Clear() Try 'get number of elements in the document Tot = WebBrowserMain.Document.All.Count TextBox1.Clear() 'generate list of clickable elements only For I = 0 To Tot - 1 CurrentLink = WebBrowserMain.Document.All(I).getattribute("ID").ToString If InStr(CurrentLink, "fgh") > 0 Then ListBox1.Items.Add(CurrentLink.ToString) temp = I 'ok so we got an element "I", that contains the right IDs 'now trigger the internal event hElement = WebBrowserMain.Document.All(I) hElement.ScrollIntoView(True) hElement.InvokeMember("onclick") Log("Clicked link") End If Next Log("END") Catch ex As Exception MsgBox(ex.ToString) End Try
When run the code works fine for buttons, checkboxes etc, but stalls on this onclick event, and I don't know why. I imagine it's because that although contained within the ID of the element I've captured, the event itself isn't named, or perhaps there's something else preventing it. I'm not a developer, and I only use VB on occasion, so any help is greatly appreciated!Code:<div id="app2437228683_diggComment3435209" fbcontext="7c279ec28a71"> <center> <a style="cursor: pointer;" onclick="fbjs_sandbox.instances.a2437228683.bootstrap();return fbjs_dom.eventHandler.call([js_dom.get_instance(this,2437228683),function(a2437228683_event) {a2437228683_doajax('Comment3435209', 'http://74.86.142.204/~tearswep/humanpets/diggComments.php?cid=3435209&up=1&diggs=2&poster=556985114&herd=1', '')},2437228683],new js_event(event));return true"> <img src="http://x.x.x.x/up.jpg" width="30" height="30" /></a><br />




Reply With Quote