MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / OnSessionQuitWait

Method OnSessionQuitWait

cpp/iedriver/IECommandExecutor.cpp:479–521  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

477}
478
479LRESULT IECommandExecutor::OnSessionQuitWait(UINT uMsg,
480 WPARAM wParam,
481 LPARAM lParam,
482 BOOL& bHandled) {
483 LOG(TRACE) << "Entering IECommandExecutor::OnAllBrowserCloseWait";
484 if (this->managed_browsers_.size() > 0) {
485 LOG(TRACE) << "Still have " << this->managed_browsers_.size() << " browsers";
486 BrowserMap::const_iterator it = managed_browsers_.begin();
487 for (; it != managed_browsers_.end(); ++it) {
488 LOG(TRACE) << "Still awaiting close of browser with ID " << it->first;
489 HWND alert_handle;
490 bool is_alert_active = this->IsAlertActive(it->second,
491 &alert_handle);
492 if (is_alert_active) {
493 // If there's an alert window active, the browser's Quit event does
494 // not fire until any alerts are handled. Note that OnBeforeUnload
495 // alerts must be handled here; the driver contains the ability to
496 // handle other standard alerts on the next received command. We rely
497 // on the browser's Quit command to remove the driver from the list of
498 // managed browsers.
499 Alert dialog(it->second, alert_handle);
500 if (!dialog.is_standard_alert()) {
501 dialog.Accept();
502 is_alert_active = false;
503 }
504 }
505 }
506 ::Sleep(WAIT_TIME_IN_MILLISECONDS);
507 ::PostMessage(this->m_hWnd,
508 WD_SESSION_QUIT_WAIT,
509 NULL,
510 NULL);
511 } else {
512 for (auto& chromium_window_handle : this->chromium_window_handles_) {
513 ::PostMessage(chromium_window_handle, WM_CLOSE, NULL, NULL);
514 }
515 this->is_waiting_ = false;
516 Response quit_response;
517 quit_response.SetSuccessResponse(Json::Value::null);
518 this->serialized_response_ = quit_response.Serialize();
519 }
520 return 0;
521}
522
523LRESULT IECommandExecutor::OnAddChromiumWindowHandle(UINT uMsg,
524 WPARAM wParam,

Callers

nothing calls this directly

Calls 8

IsAlertActiveMethod · 0.95
endMethod · 0.80
is_standard_alertMethod · 0.80
SetSuccessResponseMethod · 0.80
LOGClass · 0.50
sizeMethod · 0.45
AcceptMethod · 0.45
SerializeMethod · 0.45

Tested by

no test coverage detected