Page 1 of 1

Not able to find List items text value

Posted: Fri Nov 02, 2018 3:57 pm
by alpesh.dhakad
Hi ,

I am using Desktop application and I need to retrieve text from ListItems present in List .
I have written below code and i could not find text values. When I try to debug it is showing "null" for S and for dropDownListText showing Timeout. Though in count it is having 4.

Please refer attached screenshot.

Please suggest solution for the same. I am stuck from so many days

repo.applicationName.PARTItemsPresenter.cell_DeviceSensitivity.Click();
repo.applicationName.PARTItemsPresenter.PARTItem.Click();
repo.applicationName.PARTItemsPresenter.PARTItem.Click();

IList<Ranorex.ListItem> dropDownListText = repo.ContextMenu.PARTContent.Items;
foreach (Ranorex.ListItem element in dropDownListText)
{
ListItem s = repo.ContextMenu.PARTContent.Items.ElementAt(0);
Report.Log(ReportLevel.Success,s.Text);
}
if (repo.ContextMenu.PARTContent.Items.Count > 0)
{
Report.Log(ReportLevel.Success,"Success ");
}
else
{
Report.Log(ReportLevel.Failure,"Failed");
}
}

Re: Not able to find List items text value

Posted: Mon Nov 05, 2018 9:22 am
by odklizec
Hi,

In my opinion, your code tries to read the "Text" attribute from wrong Text repo element (always first one) and not the Text element, associated with the actually looped ListItem? Please upload a Ranorex snapshot (NOT screenshot) of the problematic list. Screenshots are not useful here. Thanks.

Re: Not able to find List items text value

Posted: Fri Nov 23, 2018 11:26 am
by alpesh.dhakad
Hi , Please refer attached snapshot.
Require solution asap.
Thanks

Ranorex xPath of problematic element(s) : /contextmenu[@processname='ProfileConsys']/list[@automationid='PART_Content']/?/?/text[@caption='Mid Range Low (70dB)']

Ranorex version : 8.1.1
OS version : Windows 7

Re: Not able to find List items text value

Posted: Fri Nov 23, 2018 1:04 pm
by odklizec
Hi,

I'm afraid, there is nothing to see in the snapshot you posted. It's almost completely empty, which means, it's useless ;) Have you grabbed it with Instant Tracking? Eventually, capture the content of list directly with Create Snapshot recording action.

BTW, Ranorex 8.1.1 is too old and no longer supported. Please update Ranorex with most recent 8.3.1 and review the problem with it. Thanks.