Page 1 of 1

SWF Application - RanoreXPath

Posted: Thu May 07, 2009 9:52 am
by Mirage
Hi again,

I have a question about XPath. When I try to identify elements in our SWT application, it generates a pretty long XPath. This can't be helped since SWT uses many layers of controls. However, notice below that it contains unnecessary items. @processname='Harmony' is included in every element. It should be enough to include it once. I really hope this can be resolved somehow, because we use oemized applications which use the same test code, but they have a different process name.

Code: Select all

/form[@title~'^Harmony\ Eclipse\ 0\.2\.0\.336']/element[@processname='Harmony' and @class='SWT_Window0' and @instance='2']/element[@processname='Harmony' and @class='SWT_Window0' and @instance='1']/element[@processname='Harmony' and @class='SWT_Window0' and @instance='4']/*/*/*/*/element[@processname='Harmony' and @class='SWT_Window0' and @instance='1']/element[@processname='Harmony' and @class='SWT_Window0' and @instance='0']/element[@processname='Harmony' and @class='SWT_Window0' and @instance='1']/text[@processname='Harmony' and @class='Edit' and @instance='0']
Thanks

Posted: Thu May 07, 2009 12:25 pm
by Support Team
Hi Mirage,
it`s not necessary to have "@processname" and "@class" attributes in every subelement.

e.g. for your element

Code: Select all

/form[@title~'^Harmony\ Eclipse\ 0\.2\.0\.336' and @processname='Harmony']/element[@instance='2']/element[@instance='1']/element[@instance='4']/*/*/*/*/element[@instance='1']/element[@instance='0']/element[@instance='1']/text[@class='Edit' and @instance='0']
For SWF applications there`s less element identification information, so our generated RanoreXPath is not optimized but we are working on a better solution for this issue.
However, you can use Ranorex Spy, select your element and modify the RxPath manually.

Regards,
Christian
Ranorex Support Team

Posted: Thu May 07, 2009 2:46 pm
by Mirage
For now, I made a little application which cleans repositories in a pre-build of the testing application. It basically removes all process and SWT class attributes, because it is too much effort to do it manually.

Works so far.