| 209 | } |
| 210 | |
| 211 | bool Element::IsInteractable() { |
| 212 | LOG(TRACE) << "Entering Element::IsInteractable"; |
| 213 | |
| 214 | bool result = false; |
| 215 | |
| 216 | // The atom is just the definition of an anonymous |
| 217 | // function: "function() {...}"; Wrap it in another function so we can |
| 218 | // invoke it with our arguments without polluting the current namespace. |
| 219 | std::wstring script_source(L"(function() { return ("); |
| 220 | script_source += atoms::asString(atoms::IS_INTERACTABLE); |
| 221 | script_source += L")})();"; |
| 222 | |
| 223 | CComPtr<IHTMLDocument2> doc; |
| 224 | this->GetContainingDocument(false, &doc); |
| 225 | Script script_wrapper(doc, script_source, 1); |
| 226 | script_wrapper.AddArgument(this->element_); |
| 227 | int status_code = script_wrapper.Execute(); |
| 228 | |
| 229 | if (status_code == WD_SUCCESS) { |
| 230 | result = script_wrapper.result().boolVal == VARIANT_TRUE; |
| 231 | } else { |
| 232 | LOG(WARN) << "Failed to determine is element enabled"; |
| 233 | } |
| 234 | |
| 235 | return result; |
| 236 | } |
| 237 | |
| 238 | bool Element::IsFocusable() { |
| 239 | LOG(TRACE) << "Entering Element::IsFocusable"; |
no test coverage detected