TestProject Forum
Powered by leading experts in the test automation community

How to select element on Auto suggestion list

Any one please help me out how to select the one option in Auto Suggestion list ion Android app

While I am recoreding I am unable to select an element in that Auto populated suggesions list

Hi @jksprasad,

Can you please send me a screenshot of this list?
In many cases, all the elements in the list are of the same type. So, you can create a custom XPath and define a parameter inside to select the required option each time. For example, if all the list element are of type android.widget.TextView and the only difference between them is the text/value, you can use this XPath:
//android.widget.TextView[@text = ‘parameter_name’]

Thanks for the response @amit.yahav

According to my scenario I am selecting one location name from the pre-populated locations list. While I am trying to select one of them in Recording mode it is not possible for me. and the element is in “android.widget.EditText”

I am sending my scenario screenshot please have a look

Hi @jksprasad,

Thank you for sharing this screenshot with me!
Please try this solution:

  1. Use “Type Text” action to search for any location that you want in the search box. I would recommend you to use an input parameter for the search value that you are typing. Let’s call this parameter ‘Location’.

  2. When the auto-suggested results appear, create a new element manually and select XPath as the locator strategy. Check what is the type of all of those auto-suggested element and create an XPath expression according to it. Assuming that the type is: android.widget.TextView, you can use this XPath: //android.widget.TextView[contains(., ‘Locator’)][0] (You should use the actual ‘Locator’ parameter).

This should select the first auto-suggested option. If you want to be more accurate, use the full name in the ‘Location’ parameter.

Let me know if it helped you :slight_smile:

Its works for me Thank you so much

You’re welcome @jksprasad!
I’m really glad to hear that it’s working for you :slight_smile:

We are always here to help!
Feel free to reach out at any time.