onLoadFinished being called multiple times without page change?

126 views
Skip to first unread message

c h

unread,
Apr 27, 2015, 1:23:11 PM4/27/15
to phan...@googlegroups.com
Hi, I'm trying to do some automation, using onUrlChanged & onLoadFinished to setup a flow structure. I think this is the correct way to do this, correct me if I'm wrong?

One problem I am having is... it can become unreliable as onLoadFinished gets called multiple times when there is no url change. Shouldn't a page only ever trigger onLoadFinished once only? What can cause it to constantly being triggered with no further page change?

Basically I'm trying to do this: initial page -> click link -> wait for new page to load, click link -> wait for new page to load, click link -> and so on... 

c h

unread,
Apr 27, 2015, 2:45:52 PM4/27/15
to phan...@googlegroups.com
Is it because of AJAX requests? Will they trigger onLoadFinished? ( I would think it doesn't since that is why there is a need for waitfor.js script https://github.com/ariya/phantomjs/blob/master/examples/waitfor.js )

James M. Greene

unread,
Apr 28, 2015, 10:09:05 AM4/28/15
to phan...@googlegroups.com

IIRC, `onLoadFinished` will be triggered by all child frames/iframes as well.

It can be a bit confusing, no doubt. Ideally frames would have a different named event like `onFrameLoadFinished`.

Sincerely,
   James M. Greene

On Apr 27, 2015 1:45 PM, "c h" <continu...@gmail.com> wrote:
Is it because of AJAX requests? Will they trigger onLoadFinished? ( I would think it doesn't since that is why there is a need for waitfor.js script https://github.com/ariya/phantomjs/blob/master/examples/waitfor.js )

--
You received this message because you are subscribed to the Google Groups "phantomjs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phantomjs+...@googlegroups.com.
Visit this group at http://groups.google.com/group/phantomjs.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages