I am trying to capture async data from an iframe inside a page with WWW::Mechanize::Chrome. The iframe - which I have no control on - loads a WebGL canvas showing a 3D model, and emits events when the 3D asset is loaded. I do have control on the page containing the iframe.
Currently I load the page with WWW::Mechanize::Chrome, sleep a while hoping that's enough for the 3D asset to load, and then move on to other things - like this:
$mech->get('http://localhost:3000/?uid=' . $c->stash('uid'));
sleep(3)
# do other things
Rather than sleeping some seconds, I would like to wait until the event signaling that the asset is loaded fires, and then move on.
Is that doable?