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

Method SetFullScreen

cpp/iedriver/Browser.cpp:836–859  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

834}
835
836bool Browser::SetFullScreen(bool is_full_screen) {
837 VARIANT_BOOL full_screen_value = VARIANT_TRUE;
838 std::wstring full_screen_script = L"window.fullScreen = true;";
839 if (!is_full_screen) {
840 full_screen_value = VARIANT_FALSE;
841 full_screen_script = L"delete window.fullScreen;";
842 }
843 this->browser_->put_FullScreen(full_screen_value);
844
845 // IE does not support the W3C Fullscreen API (and likely never will).
846 // The prefixed version cannot be triggered via JavaScript outside of
847 // a user interaction, so we're going to cheat here and manually set
848 // the fullScreen property of the window object to the appropriate
849 // value. This may interfere with polyfills in use, and if that's
850 // the case, we'll revisit this hack.
851 CComPtr<IHTMLDocument2> doc;
852 this->GetDocument(true, &doc);
853 std::wstring script = ANONYMOUS_FUNCTION_START;
854 script += full_screen_script;
855 script += ANONYMOUS_FUNCTION_END;
856 Script script_wrapper(doc, script, 0);
857 script_wrapper.Execute();
858 return true;
859}
860
861bool Browser::IsFullScreen() {
862 VARIANT_BOOL is_full_screen = VARIANT_FALSE;

Callers 2

RestoreMethod · 0.45
ExecuteInternalMethod · 0.45

Calls 2

GetDocumentMethod · 0.95
ExecuteMethod · 0.45

Tested by

no test coverage detected