Forum Discussion
If you are asking for help on a community forum I cannot just assume you have read all of the documentation, as most people don't, nor can I assume anything further than "I clicked object, it returns false - what do I do?" The item isn't selected if it's returning false, which is why I suggested you use the TC example for finding all states and focus properties of the items in your ListView - which also links to additional principles of addressing list view items. I also do not know what type of application you are testing which could have an effect if you are using custom items in your list - but now I can assume you have already read that documentation [here] too.
Have you tried using listView.TouchItem() instead of listView.SelectItem()? Or verified the item's property actually changes after it is selected? Are you using the correct property and index? What even is SelectItem(3)? Why are we all here? Why does my wife say she's not hungry and then eat my food?
Asking for help is a two way street: have some patience, understand that community members are blindly attempting to diagnose an issue that isn't our own, and that we need as much context and information as possible in order to provide clear and concise answers. Happy testing!
Ok, no problem. the problem in my opinion is that there is no classic item in the sheet but one row is one Layout see .. this is one line in listView
Mobile.Device("emulator-5554").Process("mobileclient.androidclient.Dev").Layout("NO_ID").Layout("action_bar_root").Layout("content").Layout("vmc_main_content_area").ListView("vmc_screen100_list").Layout("NO_ID")
need to somehow find out which row (Layout) is marked in the sheet. I've been struggling with this for a week but I can't figure it out... 😕
Thank you
- Kitt2 years agoRegular Contributor
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); } }
- David912 years agoFrequent Contributor
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
- 4 years ago
- 6 years ago
- 10 years ago
Recent Discussions
- 32 seconds ago
- 23 hours ago
- 7 days ago
- 11 days ago