Skip to content

Commit 95e59b0

Browse files
committed
Correcting logic in 'eager' page loading strategy for IE
1 parent 05da83d commit 95e59b0

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
lines changed

cpp/iedriver/Browser.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -509,27 +509,28 @@ bool Browser::IsDocumentNavigating(const std::string& page_load_strategy,
509509

510510
// Starting WaitForDocumentComplete()
511511
is_navigating = this->is_navigation_started_;
512-
CComBSTR ready_state;
513-
HRESULT hr = doc->get_readyState(&ready_state);
514-
if (FAILED(hr) ||
515-
is_navigating ||
516-
_wcsicmp(ready_state, L"complete") != 0 ||
517-
(page_load_strategy == "eager" && _wcsicmp(ready_state, L"interactive") != 0)) {
512+
CComBSTR ready_state_bstr;
513+
HRESULT hr = doc->get_readyState(&ready_state_bstr);
514+
if (FAILED(hr) || is_navigating) {
518515
if (FAILED(hr)) {
519516
LOGHR(DEBUG, hr) << "IHTMLDocument2::get_readyState failed.";
520517
} else if (is_navigating) {
521518
LOG(DEBUG) << "DocumentComplete event fired, indicating a new navigation.";
519+
}
520+
return true;
521+
} else {
522+
std::wstring ready_state = ready_state_bstr;
523+
if ((ready_state == L"complete") ||
524+
(page_load_strategy == "eager" && ready_state == L"interactive")) {
525+
is_navigating = false;
522526
} else {
523-
std::wstring state = ready_state;
524527
if (page_load_strategy == "eager") {
525-
LOG(DEBUG) << "document.readyState is not 'complete' or 'interactive'; it was " << LOGWSTRING(state);
528+
LOG(DEBUG) << "document.readyState is not 'complete' or 'interactive'; it was " << LOGWSTRING(ready_state);
526529
} else {
527-
LOG(DEBUG) << "document.readyState is not 'complete'; it was " << LOGWSTRING(state);
530+
LOG(DEBUG) << "document.readyState is not 'complete'; it was " << LOGWSTRING(ready_state);
528531
}
532+
return true;
529533
}
530-
return true;
531-
} else {
532-
is_navigating = false;
533534
}
534535

535536
// document.readyState == complete

cpp/iedriverserver/CHANGELOG

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ available via the project downloads page. Changes in "revision" field indicate
99
private releases checked into the prebuilts directory of the source tree, but
1010
not made generally available on the downloads page.
1111

12+
v2.45.0.4
13+
=========
14+
* Added busy check after attaching to newly launched IE instance.
15+
* Corrected logic in 'eager' page loading strategy for IE.
16+
1217
v2.45.0.3
1318
=========
1419
* Updates to JavaScript automation atoms.

cpp/iedriverserver/IEDriverServer.rc

0 Bytes
Binary file not shown.
Binary file not shown.
1.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)