encapsulate calling FindItemByProperty
#1328
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
IUIAutomationItemContainerPattern.FindItemByProperty
is useful for finding matching elements in containers, but is inconvenient to use because it requires a null pointer and complicated arguments.In the
uiawrapper
anduia_controls
modules, direct referencing of such complex COM object methods to retrieveIUIAutomationElement
and then passing it to the constructor ofUIAElementInfo
is overly responsible.It is more appropriate that those be in the
uia_element_info
module.So I defined the wrapper of UI item container in
uia_element_info
.And I changed arguments passed to
IUIAutomationItemContainerPattern.FindItemByProperty
to be an instance of a more proper type.As mentioned in #733 (comment) (317a7c9), if we try to create a null com pointer by passing
0
orNone
touia_defs.IUIA().iuia.ElementFromHandle
, an error will be raised.I realized there is a simpler way to create a null com pointer. It is just doing
POINTER(SubclassOfIUnknown)()
.