Hello, I have an Android app with a field that allows the user to text but verifies the input by providing valid suggestions in an AutoCompleteTextView. The user must select the valid auto complete option and the text is then verified. If the user does not select the auto complete option, the text is not verified even if it is typed exactly (and the user cannot continue with verifying the form). So I need a way to click the AutoCompleteTextView but it doesn’t look like Appium supports this yet.I noticed this may be an UIAutomater problem because using the UIAutomatorViewer does not reveal the AutoCompleteTextView either. Any suggestions?
Hi, Even I face the same problem; UI-Automator hasn’t acquired ability to find the elements in the auto complete form specifically in NATIVE ANDROID APPS. Thus we, testers have to skip such tests scripts. I request the SAUCE LABS team to take a look into these and please address the issue which most of the open source mobile automation testers are facing.
If any one has found solution to this problem…please share
Is anyone looking into this issue? This is a blocker for us.
definetely a blocker!
i ran into this issue a wile ago and got some attention on it, there is a bug filed for it, more info here
We overcome the issue by the coding as specified at the bottom of this message (PS: this is purely to give you an idea to overcome the idea in one way, you may think of similar solution).
After start typing in the text view, we get a view similar to the one I attached below
The autocomplete prediction is overlapping the text view nearly 25% to 30% of it’s height. So we took the location of the textview during runtime and and tell driver to click 50% down from the textview. (This is working for us in all devices since we are getting the location at Runtime.).
This is what the code we have used:
int x = element.getCenter().getX();
int y = element.getCenter().getY() + 50;
Again I want to make aware you guys that this may or may not work for all situation as this is just a workaround for one such scenario which we encountered . Just wanted to share so that someone may get relieved out of their blocker.
My understanding of the bug is that the popup window showing the auto-complete suggestions does not have focus, so the Uiautomator APIs do not return data for the new window.
I haven’t tried this myself, but perhaps generating a swipe slightly below the text view might also bring focus to the auto-complete window, which will have Uiautomator start returning data from the popup window.
Unfortunately, Appium doesn’t know how to handle autocomplete Windows yet. This issue is a known bug and already has an opened bug in Github . Your current workaround is the best thing you can do at the moment. Sorry for you. Many of us had the same problem before
For time being, we can identify by using the co ordinates and then click on AutoCompleteTextView
WebElement element = wd.findElement(By.id(“searchInputField”));
int x = element.getLocation().getX();
int y = element.getLocation().getY();
System.out.println("X value: “+x+” Y value: "+y);
TouchAction action = new TouchAction(driver).tap(x+60, y+260).release();
//If need to enter few more data in to text field, again send it by using sendKeys method and perform the action
Thanks it worked for me
That’s how simply you can click on AutoComplete TextView. There is no need to use touch action, tap, screen coordinates and UI Automates scroll methods. Just locate and type then select the desired value in autocomplete text view. Hope it will work for you as well.
driver.findElement(By.id(“Element ID”)).sendKeys(“Type what you want to select”);
I do have such fields in my native app. Have tried all the solutions given but no luck so far. Is there anything else besides these solutions. Any lead would be helpful.
Hello guys, Have tried all solutions(X,Y coordinates,Tab and auto-fill element id) it’s not working.Please let me know if any solution works.Any help appreciated!