-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
Description
It seems that webdriver always wait browser window to be stable before run executeScript
.
the condition of stable is set to be like this:
window.document.readyState === 'complete'
But...
If we have a ajax call / http long pulling / etc, the readyState
will be interactive
for a long time.
Solution(?)
make webdrive wait only for readyState is loading
See Also
- How to
executeScript
before page load by WebDriver in selenium? https://stackoverflow.com/questions/37071807/how-to-executescript-before-page-load-by-webdriver-in-selenium - A ghost driver on phantomjs quick & dirty patch https://github.com/detro/ghostdriver/issues/334#issuecomment-41361564
- Attempt to make selenium tests more reliable https://github.com/18F/calc/pull/267
- PhantomJS 1.9 has introduced
resourceTimeout
PhantomJS Log
When waiting, it output lots of logs like this:
[DEBUG - 2016-08-07T10:21:57.754Z] Session [b69451a0-5c88-11e6-bed4-fb6eca6b39c0] - _execFuncAndWaitForLoadDecorator - Page Loading in Session: true
PhantomJS Code
Do not know what SIGNAL is, what SLOT is...
GhostDriver Code
maybe change _isLoading()
to this?
/**
* Is any window in this Session Loading?
* @returns "true" if at least 1 window is loading.
*/
_isLoading = function() {
var wHandle;
for (wHandle in _windows) {
// if (_windows[wHandle].loading) {
if (_windows[wHandle].document.readyState) === 'loading')
return true;
}
}
// If we arrived here, means that no window is loading
return false;
}