0

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?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
JYP2011
  • 23
  • 5

1 Answers1

0

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

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131