Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Iamirshad94 opened this issue Jan 10, 2025 · 1 comment

Comments

@Iamirshad94
Copy link

Iamirshad94 commented Jan 10, 2025

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.

@Alpaca00
Copy link
Contributor

Please use Flutter tools to identify widgets for Flutter native applications via Flutter DevTools in Flutter Inspector.

Perform search and interaction through this Flutter Driver API.

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

No branches or pull requests

2 participants