Does there exist a way to search for if an IUIAutomationElement specified name contains whitespace?

287 Views Asked by At

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?

1

There are 1 best solutions below

0
tusar behura On

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".