Skip to content

add keywords Get Children, Get Children Locators - #94

Draft
zhajjhassan wants to merge 3 commits into
mainfrom
old_core_add_keyword_getelements
Draft

add keywords Get Children, Get Children Locators#94
zhajjhassan wants to merge 3 commits into
mainfrom
old_core_add_keyword_getelements

Conversation

@zhajjhassan

@zhajjhassan zhajjhassan commented Apr 19, 2026

Copy link
Copy Markdown

Description
The Get Children keyword always returned an empty list because AdapterFactoryImpl.get_children_adapters() was a stub (# TODO return []). This change implements the method using Finder.FindNodes() to resolve all direct children via XPath, following the same pattern as the existing get_adapter() method which uses FindSingleNode() for single element lookups.

ElementNode.RuntimeId was throwing NotImplementedException, which caused a crash when creating child adapters since RuntimeId is read to build unique locators. It now delegates to Helper.GetRuntimeId() which was already available but not wired up.

Additionally, a new Get Children Locators keyword is introduced. While Get Children returns context objects, Get Children Locators returns a list of full XPath locator strings built from the parent path plus each child's role and AutomationId or Name. These strings are human-readable in test logs and can be passed directly to other keywords like Activate or Get Property Value.

Type of Change
Bug fix (non-breaking change which fixes an issue)
New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Test Click All Calculator Digits Via Children

  • Uses Get Children to find digit buttons in the calculator's Zehnertastatur group, filters by AutomationId, and activates each one.
    Test Test Get Children
  • Verifies Get Children returns 11 child elements (digits 0-9 plus decimal separator) and reads their properties.
    Test Test Get Children Locators
  • Verifies Get Children Locators returns 11 XPath strings and that each string can be used with Get Property Value to read the AutomationId.

Test Configuration:
OS: Windows 11 ARM64
Python: 3.13.13
Robot Framework: 7.4.2
.NET Runtime: CoreCLR
Test application: Windows Calculator (Rechner)

Checklist

  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • Any dependent changes have been merged and published in downstream modules.

Additional Notes
The C# project PlatynUI.Extension.Win32.UiAutomation must be rebuilt after pulling this change so the updated ElementNode.RuntimeId implementation is included in the DLL. Run dotnet build src/PlatynUI.Spy/PlatynUI.Spy.csproj to rebuild all dependent assemblies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant