I found that if I search an IUIAutomationElement whose name contains whitespace, the FindFirst method returns nullptr, instead of the correct answer.
uiaPtr->CreatePropertyCondition(UIA_NamePropertyId, _variant_t(L"Alisha Chinai"), &search_condition);
//
auto ret = parent_uia->FindFirst(TreeScope_Subtree, search_condition, &target_uia);
I checked that the target_uia element I expect returned in the tree.
How can I fix this?
If my understanding is correct, you are looking for an object property of name that contains white space.
In that case, you can search with \n. For example, "sports\ncar".