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

Method IsHiddenByOverflow

cpp/iedriver/Element.cpp:775–804  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

773}
774
775bool Element::IsHiddenByOverflow(const LocationInfo element_location,
776 const LocationInfo click_location) {
777 LOG(TRACE) << "Entering Element::IsHiddenByOverflow";
778
779 bool is_overflow = false;
780
781 int x_offset = click_location.x - element_location.x;
782 int y_offset = click_location.y - element_location.y;
783
784 std::wstring script_source(L"(function() { return (");
785 script_source += atoms::asString(atoms::IS_OFFSET_IN_PARENT_OVERFLOW);
786 script_source += L")})();";
787
788 CComPtr<IHTMLDocument2> doc;
789 this->GetContainingDocument(false, &doc);
790 Script script_wrapper(doc, script_source, 3);
791 script_wrapper.AddArgument(this->element_);
792 script_wrapper.AddArgument(x_offset);
793 script_wrapper.AddArgument(y_offset);
794 int status_code = script_wrapper.Execute();
795 if (status_code == WD_SUCCESS) {
796 std::wstring raw_overflow_state(script_wrapper.result().bstrVal);
797 std::string overflow_state = StringUtilities::ToString(raw_overflow_state);
798 is_overflow = (overflow_state == "scroll");
799 } else {
800 LOG(WARN) << "Unable to determine is element hidden by overflow";
801 }
802
803 return is_overflow;
804}
805
806bool Element::IsEntirelyHiddenByOverflow() {
807 LOG(TRACE) << "Entering Element::IsEntirelyHiddenByOverflow";

Callers 1

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