Select item in Android list
Home › Forums › Ask Expert › Select item in Android list
- This topic has 3 replies, 3 voices, and was last updated 4 years, 9 months ago by
Sergey ZAP.
-
AuthorPosts
-
September 2, 2019 at 6:55 pm #32442
Marco Malziotti
ParticipantHi ZAPTEST Team,
I am facing following issue:
– In Android platforms after selecting “English” in translate.google.com (see screenshot1.png) is displayed list in screenshot2.png.
With my finger, scroll the list and select the langauge (if exist). How can I select specific list’s item by name stored in Datatable column “Language” in ZapTest script?
I read replay at “List object and the UI difference on different OS” topic and study “List and Tables” and “iPhone and Android” tutorial, but I don’t find solution at my issue (list in “iPhone and Android” tutorial fills only one screen and it’s not necessary to scroll the list to select item).
Can yuo help me?
Thanks.Attachments:September 2, 2019 at 11:27 pm #32443Kirill Bulatnikov
ParticipantHello Marco. Thanks for using ZAPTEST.
To perform this action you may create some virtual object, let’s call it “Language”. Prior to perform scrolling you need to set the property “Text” of this object to the value from datatable (or you can hard-code it)
[i]
Application(“Application”).View(“View”).Object(“Language”).SetProperty “Text”, DatatableValue(“A”)[/i]And in the next step apply “ScrollTo” method to this object
Application(“Application”).View(“View”).Object(“Language”).ScrollTo
Thus ZAPTEST will scroll the list until it find the object with text you need (if it’s exists, otherwise the step will report failure).
Hope that helps.
Thanks.
Kirill,
ZAPTEST Team.September 27, 2019 at 4:21 pm #32464Marco Malziotti
ParticipantThank
All works fine if “A” is below in list, but if “A” is above ScroolTo function scrool list in bottom and not find “A”.
In posted screenshot I want find “+380” prefix thath is present above selected “+39”; but ScrollTo scroll bottom.
Regards.Marco Malziotti
Attachments:September 27, 2019 at 7:18 pm #32465Sergey ZAP
KeymasterHello Marco!
If I get it correct, this list does not open with top items, but rather random.
In you case you can first scroll it up to the very top, and then scroll down to the desired item.
Example:
Application(“Application”).View(“View”).Object(“top_item”).ScrollTo 80
Application(“Application”).View(“View”).Object(“item_to_select”).ScrollTo -
AuthorPosts
- You must be logged in to reply to this topic.