-
Notifications
You must be signed in to change notification settings - Fork 7
openasync.js
Sometimes complex pages don't complete loading for a long time, but may be functionally interactive and have all the important visual parts loaded. If you have a page that takes a long time to complete loading, you can call the Browser.openAsync() function, which is the same as the Browser.open() function except it doesn't wait for the page to complete loading.
var b = pizza.open();
// Open the given site and return immediately instead of waiting for the site to load
b.openAsync("www.yelp.com");
// Wait for a element matching the CSS selector '#find_desc' (a button with id 'find_desc')
b.waitForVisible("#find_desc");
Basically when the spiny icon stops spinning.
More technically (but still not the whole story by a long shot), there two states that happen in order:
- domComplete
All javascript / css / images currently known about are downloaded and parsed.
- onload
All JavaScript currently known about is downloaded, parsed, executed for the first time, and any onload callbacks are complete.
The 'currently known about' can be the kicker, as some http items (especially 3rd party content) can reference further http items. There can also be timing issues where sometimes the last onload callback is executed before others get a chance to register their own onload callbacks and sometimes it isn't.