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

Method IsDisplayed

cpp/iedriver/Element.cpp:94–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94int Element::IsDisplayed(bool ignore_opacity, bool* result) {
95 LOG(TRACE) << "Entering Element::IsDisplayed";
96
97 int status_code = WD_SUCCESS;
98
99 // The atom is just the definition of an anonymous
100 // function: "function() {...}"; Wrap it in another function so we can
101 // invoke it with our arguments without polluting the current namespace.
102 std::wstring script_source(L"(function() { return (");
103 script_source += atoms::asString(atoms::IS_DISPLAYED);
104 script_source += L")})();";
105
106 CComPtr<IHTMLDocument2> doc;
107 this->GetContainingDocument(false, &doc);
108 // N.B., The second argument to the IsDisplayed atom is "ignoreOpacity".
109 Script script_wrapper(doc, script_source, 2);
110 script_wrapper.AddArgument(this->element_);
111 script_wrapper.AddArgument(ignore_opacity);
112 status_code = script_wrapper.Execute();
113
114 if (status_code == WD_SUCCESS) {
115 *result = script_wrapper.result().boolVal == VARIANT_TRUE;
116 } else {
117 LOG(WARN) << "Failed to determine is element displayed";
118 }
119
120 return status_code;
121}
122
123std::string Element::GetTagName() {
124 LOG(TRACE) << "Entering Element::GetTagName";

Callers 6

GetClickLocationMethod · 0.95
IsObscuredMethod · 0.80
ExecuteInternalMethod · 0.80
ExecuteInternalMethod · 0.80
ExecuteInternalMethod · 0.80
IsElementInteractableMethod · 0.80

Calls 6

GetContainingDocumentMethod · 0.95
asStringFunction · 0.85
LOGClass · 0.50
AddArgumentMethod · 0.45
ExecuteMethod · 0.45
resultMethod · 0.45

Tested by

no test coverage detected