Skip to content

Unable to Identify TextFields by Accessibility ID in Flutter App (Android) #763

@Iamirshad94

Description

@Iamirshad94

When performing automation testing on a Flutter app using Appium, elements on the login screen are not identifiable by their Accessibility ID on Android. Despite using Semantics, assigning unique keys, and other best practices, input fields such as username and password are still not being detected or validated during automation. This issue prevents the automated test cases from interacting with these elements, entering user credentials, and completing the login process.

Steps to Reproduce:
1. Open the Flutter app’s login screen on an Android device/emulator.
2. Use Appium Inspector to inspect the elements.
3. Observe that elements are not detectable by Accessibility ID or similar attributes, even when Semantics or Key has been implemented.
4. Attempt to validate and interact with the input fields during automation.

Expected Behavior:
• Each input field (e.g., username, password) and button (e.g., login) should have a unique Accessibility ID to facilitate automated interaction and validation.

Actual Behavior:
• The Accessibility ID attribute is missing or not being exposed, even when Semantics or Key is used. This makes it impossible to locate and interact with the elements using Appium for automation testing.

Code:
`Semantics(
label: 'username_field',
child: TextField(
key: Key('username_field'),
decoration: InputDecoration(
hintText: 'Enter username',
),
),
);

Semantics(
label: 'login_button',
child: ElevatedButton(
key: Key('login_button'),
onPressed: () {
// Login action
},
child: Text('Login'),
),
);`

Impact:

This issue blocks automation testing of critical features like login functionality in Flutter apps. It affects testing efficiency and increases the manual intervention required for validation.

Request:
• Please investigate why Accessibility ID is not being exposed for elements, even when Semantics and Key are used.
• Suggest alternative approaches or fixes to make elements identifiable for Appium in Flutter apps on Android.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions