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

Method IsSelected

cpp/iedriver/Element.cpp:897–921  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

895}
896
897bool Element::IsSelected() {
898 LOG(TRACE) << "Entering Element::IsSelected";
899
900 bool selected(false);
901 // The atom is just the definition of an anonymous
902 // function: "function() {...}"; Wrap it in another function so we can
903 // invoke it with our arguments without polluting the current namespace.
904 std::wstring script_source(L"(function() { return (");
905 script_source += atoms::asString(atoms::IS_SELECTED);
906 script_source += L")})();";
907
908 CComPtr<IHTMLDocument2> doc;
909 this->GetContainingDocument(false, &doc);
910 Script script_wrapper(doc, script_source, 1);
911 script_wrapper.AddArgument(this->element_);
912 int status_code = script_wrapper.Execute();
913
914 if (status_code == WD_SUCCESS && script_wrapper.ResultIsBoolean()) {
915 selected = script_wrapper.result().boolVal == VARIANT_TRUE;
916 } else {
917 LOG(WARN) << "Unable to determine is element selected";
918 }
919
920 return selected;
921}
922
923bool Element::IsImageMap(LocationInfo* location) {
924 CComPtr<IHTMLElement> map_element;

Callers 1

ExecuteInternalMethod · 0.80

Calls 7

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

Tested by

no test coverage detected