Forum Discussion
Could you try a Record Script test to see how TestComplete is doing it, then post the code output here, along with a screenshot of the item in question from the ObjectBrowser?
Also, please copy the code from here, run it, and post the results here if you can.
function CheckState()
{
// Select an Android device
Mobile.SetCurrent("MyDevice");
// Obtain an application
var app = Mobile.Device("emulator-5554").Process("mobileclient.androidclient.Dev");
// Obtain a listView
var listViewObj = app.RootLayout("").ListView("vmc_screen100_list");
// or app.RootLayout("").Layout("vmc_main_content_area").ListView("vmc_screen100_list")
for (i=0; i < listViewObj.wItemCount; i++)
{
// Check the item’s state
if (listViewObj.wSelected(i))
{
Log.Message(listViewObj.wItem(i) + " item is checked");
}
else
{
Log.Message(listViewObj.wItem(i) + " is not checked");
}
}
// Obtain the index of item with focus
var focus = listViewObj.wFocus;
if (focus == -1)
{
Log.Message("There are no focused items.");
}
else
{
Log.Message("The index of the focused item is " + focus);
}
}
Hi Kitt,
although I already tried these methods, but I ran your script above my listview. Unfortunately, he didn't catch anything..
I think it's the way I write.. it's not a classic ITEM, but a Layout, which are like individual lines..
Photo listView
- AlexKaras2 years agoChampion Level 3
Hi,
Is this a standard ListView provided by Android OS or some custom descendant? In the latter case you have two options:
a) Talk to your developers and ask them how selected item can be identified;
b) Explore selected and not selected item in the Object Browser and figure out what property or method can be used to identify the selected item.
Related Content
- 3 years agoOAn
- 5 years agopaarmann-ara
- 10 years agoAxelChrist
- 2 years agoFrits
Recent Discussions
- 3 days agovladd1