AbsolutePath property does not return absolute path

Class library usage, coding and language questions.
sintom
Posts: 3
Joined: Fri Jul 27, 2012 1:19 pm

AbsolutePath property does not return absolute path

Post by sintom » Fri Jul 27, 2012 2:01 pm

Hi,

I have following example source code:

Code: Select all

if (!repo.MenuBarExplorer.ButtonUpdaterInfo.AbsolutePath.IsAbsolute)
        		throw new RanorexException("PATH IS NOT ABSOLUTE!");
Button Updater is an SysTry icon. It is set to always visble.

Above code should throw exception when returned path is not absolute... and it throws.
The path which I get starts without slash:

Code: Select all

menubar[@processname='explorer']/container[@caption='' and @controlid='303']/container/toolbar/button[@text='Updater']
With Ranorex Spy I can find the button but only if I add missing slash (means make absolute path).

Anyway my question is: Is this mean that AbsolutePath has a bug and does not returns Absolute path?

I have Ranorex 3.0.5.

sintom
Posts: 3
Joined: Fri Jul 27, 2012 1:19 pm

Re: AbsolutePath property does not return absolute path

Post by sintom » Mon Jul 30, 2012 10:42 am

I have found reason why systray icon was not found and fixed it. Anyway I still have quesetion why AbsolutePath does not return absoulte path?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: AbsolutePath property does not return absolute path

Post by Support Team » Mon Jul 30, 2012 11:45 am

Hi,

What is the exact aim you want to achieve with this "if"-statement?
Is this mean that AbsolutePath has a bug and does not returns Absolute path?
The path is absolute (but here with ButtonUpdaterInfo.AbsolutePath without slash - because of some interne reasons).

Please update your Ranorex to the latest version. Then the spy will also find your path without a slash.

Kind Regards,
Larissa
Ranorex Support Team
.
Image

sintom
Posts: 3
Joined: Fri Jul 27, 2012 1:19 pm

Re: AbsolutePath property does not return absolute path

Post by sintom » Thu Aug 02, 2012 8:39 am

Hi,
What is the exact aim you want to achieve with this "if"-statement?
This "if"-statement is only for the testing purpose. If I have property AbsolutePath which resturns RxPath object (absoulte path) I would expect that when I invoke IsAbsolute then I get True. But the returned value in this case is False which (for me) means that this is not absolute path.

When I look on Absolute Path of some repository elemenet in the Ranorex Studio i can se that the path starts with a slash "/".

Anyway I implemented method which expects absolute path as an input. Thus at the beginnig it checks if it is absolute or not. If not it throws exception:

Code: Select all

private bool FindApplicationUpdaterIcon(RxPath path, out Ranorex.Button appUpdaterBtn)
        {
        	if (!path.IsAbsolute)
        		throw new RanorexException("Not absolute path! Path:" + path.ToString());
What I noticed about paths is that when it starts with slash then IsAbsolute returns true in other case it returns false.

Anyway I noticed that i do not really need absolute path because I want to search some controls on my local host. Thus if I use not absolute path I must(?) give a context from which the searching starts. In my case Host.Local.TryFindSingle the Host.Local is the context. Thus the controls can be found.

I was not able to find the control as I was not covered all cases of text attribute which it can have.

Summary - I was able to solve my issue :) but I'm still surprised that when I use some_controlInfo.AbsolutePath.IsAbsolute I get False