Skip to content

Missing accessibility-id for testing purposes #17988

@fhuonder

Description

@fhuonder

Internal: b/126447958

Hi,

We'd like to test our Flutter-App with Appium. To unambiguously identify the elements (text fields, buttons, ...) it is necessary to provide a "technical" identifier. Searching by name (element's label) is not a stable approach (one problem e.g. ist that the same name could be used by different elements on the view).

Appium offers the selector strategies listed here: http://appium.io/docs/en/commands/element/find-elements.
A stable strategy would be when we could assign an accessibility id to elements (for Android this would be the "content-desc"). Another approach would be to use the native element identifiers (resource-id for android, name for iOS). These can both not be set on the flutter elements.

We found out that when a Semantic Object is created for an element that its label is taken as the accessiblity identifier. But this brings two problems: First, the label is, in our understanding, not the same as the id and it should be possible to treat them differently. Second, the object tree has the semantic node next (as sibling) to the element and this leads to the situation that the actual element to test cannot be identified because there could be further elements.

This situation makes it very hard to test the app with Appium (we think the same problems occur with other testing frameworks).

Do we miss something here?
When not: Is there a workaround?

Thanks for your answer.
Best regards,
Florian

Metadata

Metadata

Assignees

Labels

P3Issues that are less important to the Flutter projecta: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)a: tests"flutter test", flutter_test, or one of our testscustomer: crowdAffects or could affect many people, though not necessarily a specific customer.frameworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions