Dropdown problems in Android app

I’m having difficulties with dropdowns in an Android mobile app (built in Xamarin), whereby I’m not able to select an item either by index or name.

I’m satisfied that I’m identifying the object correctly (e.g. with a ‘tap’ command, the dropdown items are displayed), but the item I’m specifying (by index, or by name) is not being selected (nothing is selected).

The two commands I’m using are below (logs at the end of this post)…

Mobile.selectListItemByLabel(findTestObject('Create Order/Fault Issue DROPDOWN'), 'Break', 0)
Mobile.selectListItemByIndex(findTestObject('Create Order/Fault Issue DROPDOWN'), 0, 0)

Any ideas why this is not working? Are there Xamarin specific considerations that need to be made?

Also, are there any workarounds (I’ve tried sendkeys (cursor keys, enter etc.) but that doesn’t work for me.

I read here that Mobile Select List Item By Index is not implemented for Android…is this still the case?
https://docs.katalon.com/katalon-studio/docs/mobile-select-list-item-by-index.html#description

Thanks in advance for any assistance.

Logs:

Failed to select item labeled 'Break' of object 'Object Repository/Create Order/Fault Issue DROPDOWN' (Root cause: com.kms.katalon.core.exception.StepFailedException: Item labeled 'Break' of object 'Object Repository/Create Order/Fault Issue DROPDOWN' not found
	at com.kms.katalon.core.mobile.helper.MobileElementCommonHelper.selectListItemByLabel(MobileElementCommonHelper.java:274)
	at com.kms.katalon.core.mobile.keyword.builtin.SelectListItemByLabelKeyword$_selectListItemByLabel_closure1.doCall(SelectListItemByLabelKeyword.groovy:71)
	at com.kms.katalon.core.mobile.keyword.builtin.SelectListItemByLabelKeyword$_selectListItemByLabel_closure1.call(SelectListItemByLabelKeyword.groovy)
	at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.runKeyword(MobileKeywordMain.groovy:21)
	at com.kms.katalon.core.mobile.keyword.builtin.SelectListItemByLabelKeyword.selectListItemByLabel(SelectListItemByLabelKeyword.groovy:73)
	at com.kms.katalon.core.mobile.keyword.builtin.SelectListItemByLabelKeyword.execute(SelectListItemByLabelKeyword.groovy:65)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:73)
	at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords.selectListItemByLabel(MobileBuiltInKeywords.groovy:2304)
	at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords$selectListItemByLabel$10.call(Unknown Source)
	at Create Work Order Reactive 1.run(Create Work Order Reactive 1:46)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:393)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:384)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:363)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:355)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:251)
	at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:203)
	at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:152)
	at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:95)
	at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:157)
	at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
	at TempTestSuite1609855636106.run(TempTestSuite1609855636106.groovy:39)
)


Failed to select item indexed '0' of object 'Object Repository/Create Order/Fault Issue DROPDOWN' (Root cause: com.kms.katalon.core.exception.StepFailedException: This feature is being implemented
	at com.kms.katalon.core.mobile.helper.MobileElementCommonHelper.selectItemByIndex(MobileElementCommonHelper.java:219)
	at com.kms.katalon.core.mobile.keyword.builtin.SelectListItemByIndexKeyword$_selectListItemByIndex_closure1.doCall(SelectListItemByIndexKeyword.groovy:71)
	at com.kms.katalon.core.mobile.keyword.builtin.SelectListItemByIndexKeyword$_selectListItemByIndex_closure1.call(SelectListItemByIndexKeyword.groovy)
	at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.runKeyword(MobileKeywordMain.groovy:21)
	at com.kms.katalon.core.mobile.keyword.builtin.SelectListItemByIndexKeyword.selectListItemByIndex(SelectListItemByIndexKeyword.groovy:73)
	at com.kms.katalon.core.mobile.keyword.builtin.SelectListItemByIndexKeyword.execute(SelectListItemByIndexKeyword.groovy:65)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:73)
	at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords.selectListItemByIndex(MobileBuiltInKeywords.groovy:2612)
	at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords$selectListItemByIndex$9.call(Unknown Source)
	at Create Work Order Reactive 1.run(Create Work Order Reactive 1:42)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:393)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:384)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:363)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:355)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:251)
	at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:203)
	at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:152)
	at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:95)
	at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:157)
	at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
	at TempTestSuite1609855636106.run(TempTestSuite1609855636106.groovy:39)
)

@ Katalon devs…please can you clarify anything in relation to this please?

@Kevin_McAndrew Did object 'Create Order/Fault Issue DROPDOWN' is the the right element to interact with that Mobile keyword?

Because i use similar approach and its working fine.
This is my scenario:
//element to trigger my dropdown
Mobile.tap(findTestObject('Button to trigger dropdown'), 10)
//verifying class listView appear
Mobile.verifyElementVisible(findTestObject('My listview object'), 25)

//select label from listView
Mobile.selectListItemByLabel(findTestObject('My listview object'), 'My desired label', 10)

Or maybe u can try this

// I assume this will trigger the dropdown list
Mobile.tap(findTestObject('Create Order/Fault Issue DROPDOWN'), 10)

//this will scroll the dropdown list until found text “Break”
Mobile.scrollToText('Break')

//Tap desired object
Mobile.tap(findTestObject(‘Your ‘Break’ test object’), 10)

@roelz thanks for your reply, it’s been a few weeks since I last looked at this, but let me try the things you’ve suggested and I’ll let you know how I get on - thank you :slight_smile:

@roelz, unfortunately I haven’t been able to make any progress on this.

With your first suggestion, tapping the dropdown object works fine, but I can’t identify the individual listview items as objects (so I can’t verify they’re visible), and using the Mobile.selectListItemByLabel does not work (I’ve tried it against every possible object in the various object layers).

I think I’d tried the Mobile.scrollToText command previously, but I retried it again today and unfortunately it results in an error…

Unable to scroll to text ‘List Item Text’ (Root cause: org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters.

…but even then I wouldn’t be able to tap on it because I can’t identify the list items as objects. I’ve tried sendkeys as a workaround (e.g. down, enter), but this doesn’t result in any items being selected.

But I do appreciate your help @roelz - I wonder if it’s because the app is built with Xamarin and maybe that generates objects in a way that is imcompatible with current Katalon commands?

@Thong @duyluong are you able to confirm my suspicions re Xamarin, or advise any workarounds please?