Optimized looking at progress indicators and fixed a looping error.  Also added a configurable timeout parameter.
Merge pull request #1012 from mutualmobile/master

Optimized waitForPageLoad and added timeout