JYP2011
JYP2011

Reputation: 33

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

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?

Upvotes: 0

Views: 315

Answers (1)

tusar behura
tusar behura

Reputation: 11

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

Upvotes: 0

Related Questions