Hi Team,
I am using desktop application and there are lot of Listitems in which Text value is available which I want to collect in some list.
So, could you please suggest a solution to collect the listitems text in some list or any other way which I can compare later with test data.
Some of the listitems are empty which doesn't contain any text. (May be those listitems are hidden)
I have tried below solution but not able to get any value
IList<Ranorex.ListItem> list = repo.AddDevices.AllDevicesContainerInfo.CreateAdapters<Ranorex.ListItem>();
string deviceList = item.Element.GetAttributeValueText("text");
foreach (Ranorex.ListItem item in list) {
string deviceList = item.Element.GetAttributeValueText("text");
Report.Info(item.Text + " is member of CategoryList");
}
In the screenshot attached, I am able to click on Detectors dropdown using below xpath but not able to retrieve the list under that:
progressbar/container[@automationid='PART_AutoHideControl']//button/list/listitem[@actualcaption='801 CH']/ancestor::container[@automationid='PART_ItemsPresenter']//container[@automationid='PART_DropDown']
Please refer attached screenshots for UI and SPY (listitems) and snapshots.
How to retrieve list items text and then compare it
-
- Posts: 35
- Joined: Wed Oct 31, 2018 2:10 pm
How to retrieve list items text and then compare it
You do not have the required permissions to view the files attached to this post.
Re: How to retrieve list items text and then compare it
Hi,
Please post a Ranorex snapshot (NOT screenshots). This would help us understand the GUI. Screenshots are, more or less, useless here Thanks.
Anyway, on the first sight, I see you are trying to collect ListItems, but the the text you are looking for is actually stored in "Text" element! So the xpath of repoitem repo.AddDevices.AllDevicesContainerInfo must point to the Text element, instead of ListItem, like this...
And of course, you must adapt the code accordingly.
Please move the snapshot you posted in duplicated post to this one instead and delete the duplicated post. Thanks.
Please post a Ranorex snapshot (NOT screenshots). This would help us understand the GUI. Screenshots are, more or less, useless here Thanks.
Anyway, on the first sight, I see you are trying to collect ListItems, but the the text you are looking for is actually stored in "Text" element! So the xpath of repoitem repo.AddDevices.AllDevicesContainerInfo must point to the Text element, instead of ListItem, like this...
Code: Select all
/contextmenu[@Visibility='Visible']/list/ListItem/Text
Code: Select all
IList<Ranorex.Text> list = repo.AddDevices.AllDevicesContainerInfo.CreateAdapters<Ranorex.Text>();
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
-
- Posts: 35
- Joined: Wed Oct 31, 2018 2:10 pm
Re: How to retrieve list items text and then compare it
Hi,
Please refer attached snapshot. Let me know anything else I need to share.
Thanks
Please refer attached snapshot. Let me know anything else I need to share.
Thanks
You do not have the required permissions to view the files attached to this post.
Re: How to retrieve list items text and then compare it
Hi,
So now try to implement changes I mentioned in my answer And please delete the duplicated post by clicking Delete button...
So now try to implement changes I mentioned in my answer And please delete the duplicated post by clicking Delete button...
You do not have the required permissions to view the files attached to this post.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
-
- Posts: 35
- Joined: Wed Oct 31, 2018 2:10 pm
Re: How to retrieve list items text and then compare it
Hi ,
I am not able to view delete option in my post. So, unable to delete that post.
I am not able to view delete option in my post. So, unable to delete that post.
You do not have the required permissions to view the files attached to this post.
Re: How to retrieve list items text and then compare it
Ho, try it now. I just deleted my post, which was maybe a reason why you could not delete the post.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
-
- Posts: 35
- Joined: Wed Oct 31, 2018 2:10 pm
Re: How to retrieve list items text and then compare it
Thanks. Your suggested solution worked.
I have also deleted duplicate entry.
I have also deleted duplicate entry.