If you're on Win32, you can use
Win32::OLE, especially
Win32::IE::Mechanize, which starts IE, and drives it (i.e., follows links, submit forms, click a button, etc.) I've used it to run tests against an application that uses javascript. Since you're really using IE, javascript/browser events are all handled, but I did not try to access a dynamically constructed document, as is in your case. There is also a project called Samie, which basically does the same thing (direclty uses Win32::OLE).