Unable to access listitem from a WPF list

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
sherinjab
Posts: 23
Joined: Wed Oct 08, 2014 2:57 pm

Unable to access listitem from a WPF list

Post by sherinjab » Thu Aug 13, 2015 1:34 pm

Hi,
I'm unable to access the listItem Purchase Order Processing , which is within a list (List2 in below image)
RanorexListIssue.png
When I check the RXPath for this control using Spy, it's shown as

Code: Select all

"/form[@wpfnative='True' and @title='Hubble [DEMO900]' and @processname='Hubble']/?/?/element[@automationid='BackStageContent']/list[@automationid='backstage']/element[@automationid='backstageTabNew']/container[@automationid='newInquiryControlBackstage']//list[@automationid='ModulesMenu']/container/container[2]/list"
. I tried adding /listitem[@name='Purchase Order Processing']' to the end and then access the control but it doesn't seem to work.
What's wierd is that the I can access the items within list1 using an RxPath which I had noted using an older version of ranorex and looks very different

Code: Select all

/form[@name='Hubble [DEMO900]']/?/?/element[@automationid='newInquiryControlBackstage']/container[1]/list[1]/listitem[@name='General Ledger'']
The only difference between these two lists is that they are in different containers so I tried by accessing it with the same RXPath as above but container[2] but even that didn't seem to work.
I even tried getting the items from the list through code but still hasn't helped

Code: Select all

    IList<Ranorex.List> purchaseOrderModuleSelection = form.Find<Ranorex.List>("/form[@wpfnative='True' and @title='Hubble [DEMO900]' and @processname='Hubble']/?/?/element[@automationid='BackStageContent']/list[@automationid='backstage']/element[@automationid='backstageTabNew']/container[@automationid='newInquiryControlBackstage']//list[@automationid='ModulesMenu']/container/container[2]/list");
                    foreach (Ranorex.List item in purchaseOrderModuleSelection)
                    {
                        IList<Ranorex.ListItem> itemNames = item.Items;
                        foreach (Ranorex.ListItem lstItem in itemNames)
                        {
                            string s = lstItem.Text;
                        }
                    }

Could someone help me understand how I can get access to the items with the second List?

Thanks,
Sherin
You do not have the required permissions to view the files attached to this post.
Last edited by sherinjab on Wed Aug 19, 2015 3:36 pm, edited 2 times in total.

sherinjab
Posts: 23
Joined: Wed Oct 08, 2014 2:57 pm

Re: Unable to access listitem from a WPF list

Post by sherinjab » Thu Aug 13, 2015 1:49 pm

I've also added a snapshot of the control for the above mentioned query
You do not have the required permissions to view the files attached to this post.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Unable to access listitem from a WPF list

Post by Support Team » Mon Aug 17, 2015 11:03 am

Hello sherinjab,

Please update to our latest version, currently Ranorex 5.4. and check if you are able to recognize the elements.

If not, please try to enable “Realize Items in Virtualizing Containers” and/or “Show All Elements” within the Ranorex Spy settings.
SpySettingsWPF.png
Hope this helps.

Regards,
Robert
You do not have the required permissions to view the files attached to this post.

sherinjab
Posts: 23
Joined: Wed Oct 08, 2014 2:57 pm

Re: Unable to access listitem from a WPF list

Post by sherinjab » Wed Aug 19, 2015 3:31 pm

Hi Robert,

Thanks for the suggestion but unfortunately that hasn't helped me to solve my issue. I tried my tests after enabling both options by itself and together but couldn't achieve the goal.

When I enabled the "Show All elements" option, it could find all the ListItems on Spy and returned the RxPath as

Code: Select all

"/form[@wpfnative='True' and @title='Hubble [DEMO900]' and @processname='Hubble']/element[@automationid='PART_Adorner']/element[@automationid='PART_Border']/?/?/element[@automationid='BackStageContent']/?/?/list[@automationid='backstage']/element[@automationid='backstageTabNew']/container[@automationid='newInquiryControlBackstage']/?/?/element/container/container[1]//element[@automationid='PART_ScrollContentPresenter']/list[@automationid='ModulesMenu']/?/?/list/container/element[2]/container/list/list/container/listitem[1]"
However it actually made things worse as my test failed as it couldn't identify the first control in the test using the current RxPath. I guess enabling this option changes the RxPath of all controls and that would be too much effort if we need to do that to get access to this list item.

I'm still using Ranorex 5.3 as I had many issues with Ranorex 5.4 and noticed that it couldn't run my tests using my current RxPath and required modifications of Rxpaths for many controls. This was definitely not expected as I don't think we should have to modify the Rxpaths after every upgrade. So I've actually gone back to 5.3.3 after trying 5.4.

For the mentioned issue, I noticed that it can identify the List control when I give the RxPath as

Code: Select all

"/form[@wpfnative='True' and @title='Hubble [DEMO900]' and @processname='Hubble']/?/?/element[@automationid='BackStageContent']/list[@automationid='backstage']/element[@automationid='backstageTabNew']/container[@automationid='newInquiryControlBackstage']//list[@automationid='ModulesMenu']/container/container[2]/list"
. However I want a particular listItem to be clicked based on the name and I'm not able to achieve this so far. Even the count of Children of the List is shown as zero.

Please let me know if there is anything else that I can try as I really need this to work to automate major areas of our application.

Thanks,
Sherin

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Unable to access listitem from a WPF list

Post by Support Team » Fri Aug 21, 2015 11:26 am

Hi Sherin,

I'm afraid that we will need further information in order to resolve the issue. Please contact [email protected].

Thank you in advance.

Regards,
Robert

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Unable to access listitem from a WPF list

Post by Support Team » Fri Aug 28, 2015 8:41 am

Hello all,

We fixed the issue by using the UIA plugin instead of the WPF plugin. :)

Kind regards,
Robert

QAMember1
Posts: 6
Joined: Tue Jun 23, 2015 1:23 pm

Re: Unable to access listitem from a WPF list

Post by QAMember1 » Wed Sep 09, 2015 7:38 pm

We are having the same issue with lisbox items in WPF.

Are you stating that we should be using "Show All Elements" set to true for this to work? Are you stating that we need to use UIA (UAIOnly or UIA Preferred?) setting as well to get this to work?

I was told not to use "Show All Elements" set to true since the xpath will have too many items and slow the process down. Since we can't mix our repository with xpath with some show all elements set to true and some set to false, should we be using it set to True for all our xpath?

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Unable to access listitem from a WPF list

Post by Support Team » Fri Sep 11, 2015 7:30 am

Hello QAMember1,

No, the „Show All Elements“ should just be used to check if the element can be made accessible at all.
As for your issue, are you able to access the elements via UIA?

Regards,
Robert

QAMember1
Posts: 6
Joined: Tue Jun 23, 2015 1:23 pm

Re: Unable to access listitem from a WPF list

Post by QAMember1 » Fri Sep 11, 2015 5:18 pm

Robert, Yes, I am able to access the item using UIA. Hansel provided a solution that is working for us right now. Basically, we are now using WPFPreferred with show all elements set to false. Any item that WPF is not able to locate, we use UIA.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Unable to access listitem from a WPF list

Post by Support Team » Tue Sep 15, 2015 12:17 pm

Hi QAMember1,

I'm glad that you found a solution.

Regards,
Robert

smohanty78
Posts: 23
Joined: Tue Feb 10, 2015 10:51 am

Re: Unable to access listitem from a WPF list

Post by smohanty78 » Tue Oct 13, 2015 8:22 pm

Hi All,
I am also facing the same problem .If I am selecting "Show all elemets" to true in WPF controls some of the objects in the grid are getting identified but some are not getting identified.
I have selected the option as WPFPreffered.
Please suggest me what to select in the plug ins option.
Please help me out to resolve this issue as I need it urgently
regards,
Sangita

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

Re: Unable to access listitem from a WPF list

Post by odklizec » Wed Oct 14, 2015 8:11 am

Hi Sangita,

Have you tried the solution mentioned just two posts above yours? ;)

Please try to set the WPFPreferred with "Show all elements" set to false. If it still does not work, try UiaOnly instead of WPFPreferred . This disables new Ranorex 5.3.x plugin and uses old way of WPF elements recognition. Here is a WPF plugin settings description from help:
Set to 'UiaOnly' to completely deactivate this plug-in, making all other settings obsolete.
WpfOnly: Show only the native WPF plug-in tree, suppress UIA.
WpfPreferred: Show both WPF and UIA tree, and return WPF elements for tracking.
UiaPreferred: Show both WPF and UIA tree, and return UIA elements for tracking.
UiaOnly: Do not use the native WPF plug-in at all, and keep using UIAutomation for WPF as in Ranorex versions up to 5.2.
However, despite of all possible Ranorex settings, there may be some elements, which attributes cannot be read by Ranorex, no matter what. In this case, I would suggest you to create a new post, where you should describe your problem in more details and post a Ranorex snapshot, or better two snapshots, both with WPFPreferred and UiaOnly setting.
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

smohanty78
Posts: 23
Joined: Tue Feb 10, 2015 10:51 am

Re: Unable to access listitem from a WPF list

Post by smohanty78 » Wed Oct 14, 2015 9:17 am

Thanks for responding.
For one filter control if I am setting showallements to true I am able to get the element but rest all elements are not getting identified.
So I wanted to know is it possible to change the settings for WPF plugin showallelements to 'True' during runtime?
After clicking on the filter control I will again change it back to 'False' programmatically
is it possible?
please do respond
regards,
Sangita