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

Method GetContentWindowHandle

cpp/iedriver/Browser.cpp:314–350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

312}
313
314HWND Browser::GetContentWindowHandle() {
315 LOG(TRACE) << "Entering Browser::GetContentWindowHandle";
316
317 HWND current_content_window_handle = this->window_handle();
318 // If this window is closing, the only reason to care about
319 // a valid window handle is to check for alerts whose parent
320 // is this window handle, so return the stored window handle.
321 if (!this->is_closing()) {
322 // If, for some reason, the window handle is no longer valid, set the
323 // member variable to NULL so that we can reacquire the valid window
324 // handle. Note that this can happen when browsing from one type of
325 // content to another, like from HTML to a transformed XML page that
326 // renders content. If the member variable is NULL upon entering this
327 // method, that is okay, as it typically means only that this object
328 // is newly constructed, and has not yet had its handle set.
329 bool window_handle_is_valid = ::IsWindow(current_content_window_handle);
330 if (!window_handle_is_valid) {
331 LOG(INFO) << "Flushing window handle as it is no longer valid";
332 this->set_window_handle(NULL);
333 }
334
335 if (this->window_handle() == NULL) {
336 LOG(INFO) << "Restore window handle from tab";
337 // GetBrowserWindowHandle gets the TabWindowClass window in IE 7 and 8,
338 // and the top-level window frame in IE 6. The window we need is the
339 // InternetExplorer_Server window.
340 HWND tab_window_handle = this->GetBrowserWindowHandle();
341 if (tab_window_handle == NULL) {
342 LOG(WARN) << "No tab window found";
343 }
344 HWND content_window_handle = this->FindContentWindowHandle(tab_window_handle);
345 this->set_window_handle(content_window_handle);
346 }
347 }
348
349 return this->window_handle();
350}
351
352std::string Browser::GetWindowName() {
353 LOG(TRACE) << "Entering Browser::GetWindowName";

Callers 15

AddManagedElementMethod · 0.45
SetFocusToBrowserMethod · 0.45
ResetMethod · 0.45
PointerMoveToMethod · 0.45
PointerDownMethod · 0.45
PointerUpMethod · 0.45
KeyDownMethod · 0.45
KeyUpMethod · 0.45
PauseMethod · 0.45
ExecuteInternalMethod · 0.45
UploadFileMethod · 0.45

Calls 6

is_closingMethod · 0.80
set_window_handleMethod · 0.80
LOGClass · 0.50
window_handleMethod · 0.45

Tested by

no test coverage detected