Page 1 of 1

No element found for path for Dev Express using application

Posted: Wed Sep 03, 2014 1:09 pm
by thilina
Hi,
We are in the process of evaluating UI automation tool. In that process I found following error.

First time error
Failed to find item 'POC_2Repository.FormMain.BarButtonItemLinkcreateOrderItem'.
No element found for path './/container[@automationid='LayoutGroup_LayoutGroup(35680165)']/container[@automationid='LayoutGroup_LayoutGroup(21144166)']/container[@automationid='ORDER LIST']/container[@name='PART_Content']/?/?/container[@name='BarManagerbarManager1']/container[@name='Top BarContainerControl']/toolbar[@name='View Navigator']/button[@automationid='createOrderItem']' within 30s.
Next time error
Failed to find item 'POC_2Repository.FormMain.BarButtonItemLinkcreateOrderItem'.
No element found for path './/container[@automationid='LayoutGroup_LayoutGroup(65774263)']/container[@automationid='LayoutGroup_LayoutGroup(37709667)']/container[@automationid='ORDER LIST']/container[@name='PART_Content']/?/?/container[@name='BarManagerbarManager1']/container[@name='Top BarContainerControl']/toolbar[@name='View Navigator']/button[@automationid='createOrderItem']' within 30s.
After investigation I found that UI element names of the application changes time to time. We use dev express as ui library.
Can you please suggest me a work around to tackle this problem

Re: No element found for path for Dev Express using application

Posted: Thu Sep 04, 2014 6:09 am
by thilina
This the first time
devExpress1.png
Now the element name are changed :(
devExpress2.png
Can anybody give suggest a work around please ?

Re: No element found for path for Dev Express using application

Posted: Thu Sep 04, 2014 1:45 pm
by krstcs
Well, first and foremost, AutomationID should not be changing every time the software runs. AutomationID should be static (remain unchanged) throughout the build. This is a requirement for MSAA and usability standards. You should have your developers fix the issue by making the AutomationID attribute of these containers be static. The reason they are using a variable number is probably becuase they are making the system choose a value instead of telling it what to use. See this page: http://msdn.microsoft.com/en-us/library ... ionid.aspx --- Note that in the description, the AutomationID property must UNIQUELY identify the element. You have 2 elements with the same BASE AutomationID, so the system appends random numbers to them. This is a bug (due to misuse of a standard attribute).

Having said that though, the AutomationID may change in each new build, which means your devs may not want to do anything about it (although they should because anything that makes testing easier will make it easier to get feedback on their software).



For your part, you could change your RXPath to include regular expressions (Regex) for those objects that have changing attribute values:

Code: Select all

.//container[@automationid~'LayoutGroup_LayoutGroup\([0-9]+\)']/container[@automationid~'LayoutGroup_LayoutGroup\([0-9]+\)']/container[@automationid='ORDER LIST']/container[@name='PART_Content']/?/?/container[@name='BarManagerbarManager1']/container[@name='Top BarContainerControl']/toolbar[@name='View Navigator']/button[@automationid='createOrderItem']

Note that this will find the first path that matches, so if there are multiple paths similar to this when you run the test and you need a specific container, then this might not be the best way.


Also, have you tried using a different attribute?

Re: No element found for path for Dev Express using application

Posted: Fri Sep 05, 2014 5:01 am
by thilina
Thank you for the reply, I will ask our developers to look in to this.

Since I'm new to ranorex, can you please tell me what " different attribute" are ?

Re: No element found for path for Dev Express using application

Posted: Fri Sep 05, 2014 1:28 pm
by krstcs
Any thing with the "@" symbol in front of it in the XPath is an attribute.

Attributes are defined by the developers of your application, Ranorex just uses them to identify the elements.

For example, the text attribute of an OK button element would probably contain "OK". But the button might also have an AutomationID attribute of "OKButton". Either (or both) of these could be used in the RanoreXPath to identify the specific element. The path for your OK button here could be any of these:

/button[@text='OK']
/button[@automationid='OKButton']
/button[@text='OK' and @automationid='OKButton']

You can also use things like @visible='true' (or 'false') and @enabled='true' (or 'false'), depending on the element and how the developers coded them.