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

Method GetBrowserWindowHandle

cpp/iedriver/Browser.cpp:808–834  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

806}
807
808HWND Browser::GetBrowserWindowHandle() {
809 LOG(TRACE) << "Entering Browser::GetBrowserWindowHandle";
810
811 HWND hwnd = NULL;
812 CComPtr<IServiceProvider> service_provider;
813 HRESULT hr = this->browser_->QueryInterface(IID_IServiceProvider,
814 reinterpret_cast<void**>(&service_provider));
815 HWND hwnd_tmp = NULL;
816 this->browser_->get_HWND(reinterpret_cast<SHANDLE_PTR*>(&hwnd_tmp));
817 if (SUCCEEDED(hr)) {
818 CComPtr<IOleWindow> window;
819 hr = service_provider->QueryService(SID_SShellBrowser,
820 IID_IOleWindow,
821 reinterpret_cast<void**>(&window));
822 if (SUCCEEDED(hr)) {
823 // This gets the TabWindowClass window in IE 7 and 8,
824 // and the top-level window frame in IE 6.
825 window->GetWindow(&hwnd);
826 } else {
827 LOGHR(WARN, hr) << "Unable to get window, call to IOleWindow::QueryService for SID_SShellBrowser failed";
828 }
829 } else {
830 LOGHR(WARN, hr) << "Unable to get service, call to IWebBrowser2::QueryInterface for IID_IServiceProvider failed";
831 }
832
833 return hwnd;
834}
835
836bool Browser::SetFullScreen(bool is_full_screen) {
837 VARIANT_BOOL full_screen_value = VARIANT_TRUE;

Callers 4

OnQuitMethod · 0.95
IsProtectedModeMethod · 0.45

Calls 2

QueryServiceMethod · 0.80
LOGClass · 0.50

Tested by

no test coverage detected