Not able to find List items text value

Ask general questions here.
alpesh.dhakad
Posts: 6
Joined: Wed Oct 31, 2018 2:10 pm

Not able to find List items text value

Post by alpesh.dhakad » Fri Nov 02, 2018 3:57 pm

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");
}
}
Attachments
List items.png
List items.png (91.32 KiB) Viewed 204 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 4653
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Not able to find List items text value

Post by odklizec » Mon Nov 05, 2018 9:22 am

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.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

alpesh.dhakad
Posts: 6
Joined: Wed Oct 31, 2018 2:10 pm

Re: Not able to find List items text value

Post by alpesh.dhakad » Fri Nov 23, 2018 11:26 am

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
Attachments
List_Device_Snapshot.rxsnp
L
(3.33 KiB) Downloaded 4 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 4653
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Not able to find List items text value

Post by odklizec » Fri Nov 23, 2018 1:04 pm

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.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration