I'm trying to read an HTML element's aria-label attribute using IE's getAttribute
method in C++/COM but although this works fine for other attributes (including aria-labelledby) it returns VT_NULL for aria-label.
My code example looks like this:
CComVariant label;
elem->raw_getAttribute(CComBSTR(L"aria-label"), 0, &label);
if (label.vt == VT_BSTR && SysStringLen(label.bstrVal)) {
// This is never reached
}
I get the same results when using 2 for the flags
argument of getAttribute
.
Sample HTML here.
When I try using getAttribute
in JavaScript in the browser this works perfectly but for some reason I can't reach this attribute using COM.
Am I missing something here?