for (def i : (0…2)) {
Mobile.tap(findTestObject(‘todaytask/waterdrop’), 0)
Mobile.selectOptionByIndex(findTestObject(‘todaytask/waterdrop’), i)
}
can’t able to get the drop down function , i use the above code
for (def i : (0…2)) {
Mobile.tap(findTestObject(‘todaytask/waterdrop’), 0)
Mobile.selectOptionByIndex(findTestObject(‘todaytask/waterdrop’), i)
}
can’t able to get the drop down function , i use the above code
Hi @bibina.kp,
First of all, are you trying to do this on iOS or Android? It looks like the Android function isn’t implemented (or at least not well-supported) because of the way that Android loads drop-down lists as-needed.
If you’re trying this on iOS, do you see any errors? Could you share the details of what the todaytask/waterdrop
TestObject looks like (by double-clicking the object from the Object Repository)?
Alternatively, you could check out an open source library I created to help with a lot of common test functions, like scrolling:
You can add it to your project using these Installation Instructions.
Hope this helps,
Chris
Using Android .
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable as GlobalVariable
Mobile.startApplication('/home/uvionics/Desktop/Fitbit_v2.60_apkpure.com.apk', false)
Mobile.tap(findTestObject('todaytask/Log in'), 0)
Mobile.tap(findTestObject('todaytask/email'), 0)
Mobile.setText(findTestObject('todaytask/email'), 'bibina.kp@uvionicstech.com', 0)
Mobile.setText(findTestObject('todaytask/password'), '9496631573', 0)
Mobile.tap(findTestObject('todaytask/login2'), 0)
Mobile.tap(findTestObject('todaytask/CLICK'), 0)
Mobile.tap(findTestObject('todaytask/clickplus'), 0)
Mobile.tap(findTestObject('todaytask/water am'), 0)
Mobile.setText(findTestObject('todaytask/water am'), '100', 0)
for (def i : (1..3)) {
Mobile.tap(findTestObject('todaytask/waterdrop'), i)
//Mobile.tap(findTestObject('todaytask/WaterOZ'), 1)
//Mobile.tap(findTestObject('todaytask/Watercup'), 2)
// Mobile.tap(findTestObject('todaytask/waterml'), 3)
Mobile.selectOptionByIndex(findTestObject('todaytask/waterdrop'), i)
}
Mobile.tap(findTestObject('todaytask/watersave'), 0)
object.zip (864 Bytes)
Hi @bibina.kp,
Thanks for sharing your code - that helps me understand what you’re trying to do a lot better!
Unfortunately, looking at the docs for Mobile.selectListItemByIndex()
it seems like this isn’t supported on Android.
I opened an issue in the katalon-mobile-util project to see if we can implement a way to do this on Android. Note that this project isn’t part of Katalon Studio - it’s a separate open source library of convenience functions.
– Chris