picture accessible descriptions not working properly

Ask general questions here.
User avatar
Gunner1980
Posts: 89
Joined: Mon Apr 05, 2010 8:44 pm
Location: Austin, Texas

picture accessible descriptions not working properly

Post by Gunner1980 » Thu Dec 16, 2010 6:18 pm

I am trying to identify objects in a QT GUI using picture descriptions. This is an image that changes based on different system states as does the picture description. I cannot use image validation for this as I have multiple statuses that utilize the same pictures.

The spying initially works when trying to highlight from the repository however once the picture changes the highlight function starts highlighting incorrect pictures.

For example one description is "This server is in sync"
Another description is "This serer is not in sync"

I have the following picture repo items named as follows to represent those. I am using indexes to represent the different pictures for my 1st and 2nd statuses.

.//picture[@accessibledescription='This server is not in sync'][1]
.//picture[@accessibledescription='This server is not in sync'][2]

.//picture[@accessibledescription='This server is in sync'][1]
.//picture[@accessibledescription='This server is in sync'][2]

When picture 1 changes from accessibledescription "This server is not in sync" to "This server is in sync" Rnaorex does not pick up on it and if I try to highlight the repo item it will highlight the picture for either of the pictures in my repo.

It seems to dislike the state changes. I am suing Ranorex 2.3.5. Please fix this as I am out of options.

User avatar
Gunner1980
Posts: 89
Joined: Mon Apr 05, 2010 8:44 pm
Location: Austin, Texas

Re: picture accessible descriptions not working properly

Post by Gunner1980 » Thu Dec 16, 2010 6:27 pm

I have also tried this as a work around but apparently I can't perform this on an image based validation, what gives?

Code: Select all

bool result = Validate.NotExists(repo.FormSystem_Manager___UNCLASS.PictureGraphicInfo);

if (result == true)
{
        Report.Success("All system times have been synchronized");
}
else			    
{
        Report.Failure("System times failed to syncrhonize within 90 seconds");
 }
whenever I try this I get the following error:

Cannot implicitly convert type 'void' to 'bool' (CS0029)

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

Re: picture accessible descriptions not working properly

Post by Support Team » Thu Dec 16, 2010 7:20 pm

Gunner1980 wrote:I have also tried this as a work around but apparently I can't perform this on an image based validation, what gives
You can, you just have to use the right overload of the Validate.NotExist method - as with any repository item, no matter if it's a image based one or not:
bool result = Validate.NotExists(repo.FormSystem_Manager___UNCLASS.PictureGraphicInfo, "Your message", false);
To your actual problem: I'm not really sure that I understand it correctly, so I will try to paraphrase it:
You have multiple pictures in your application that support MSAA and have an AccessibleDescription that changes over time. In this particular case, the description of your pictures has only two different states. You now have repository items for the individual pictures in your repository and these repository items use the AccessibleDescription attribute in their RanoreXPath.

This should happen when you run your Ranorex code: When you use the repository items in your Ranorex code, the item with index [1] will find the first item that currently has the specified AccessibleDescription. The item with index [2] will find the second item with that description. When the description of the first picture changes, the first repository item with index [1] will now point to the second picture, since this is currently the first picture with the specified AccessibleDescription.

Imagine a repository with two repository items, "MyPicture1" and "MyPicture2" with the RanoreXPaths ".//picture[@accessibledescription='State1][1]" and ".//picture[@accessibledescription='State1'][2]". Then this example should do the following (see comments in code):
// search the first image
Picture picture1 = repo.MyPicture1;
// search the second image
Picture picture2 = repo.MyPicture2;
// now assume the AccessibleDescription of picture1 changes.
// the Accessible.Description property should reflect that change
string picture1Description = new Accessible(picture1).Description;
// however, when you now search for "MyPicture1" again using the repository
// you will get the actual second image, because it is the first with the
// description "State1"
picture2 = repo.MyPicture1;
Please, check if the above scenario is the problem you observe. If it is, then this is not a bug, but by design :-) Every time you get an item from the repository, the corresponding UI element is again searched using the RanoreXPath specified for that repository item. That's why it is usually a good idea not to use attributes with variable values in RanoreXPaths, unless you really want to search for elements that currently have that value.

If I did not understand your problem correctly, please, try to describe the scenario in more detail. Snapshots of the application and the problematic pictures in different states can also be of help.

Regards,
Alex
Ranorex Team
.
Image

User avatar
Gunner1980
Posts: 89
Joined: Mon Apr 05, 2010 8:44 pm
Location: Austin, Texas

Re: picture accessible descriptions not working properly

Post by Gunner1980 » Thu Dec 16, 2010 10:40 pm

Lets take the indexes out of the equation for a minute. I understand what you are saying and I don't think that is the problem. I have addressed those types of issues before with other indexed repo items in my application which is why I am trying to use the accessible description and not just an index number. Lets say I only have 1 picture that changes accessible descriptions and I have the following paths laid out for each picture.

.//picture[@accessibledescription='This server is not in sync']
.//picture[@accessibledescription='This server is in sync']

Ok now lets say I bring the system up and the picture is in the "This server is not in sync" state.

I click Highlight repository item in Ranorex on item .//picture[@accessibledescription='This server is not in sync'] and it recognizes the correct picture.

Then the state of that picture changes to be in the "This server is in sync" state.

I click Highlight repository item in Ranorex on item .//picture[@accessibledescription='This server is in sync'] and it cannot find the item.

I then click Highlight repository item in Ranorex on item .//picture[@accessibledescription='This server is not in sync'] and it does find the item even though when I spy on the item is says the accessible description is "This server is in sync".

I then restart Ranorex studio and perform the same highlight option and it finds the correct description of "This server is in sync".

It doesn't seem to recognize the state changes without a restart of Ranorex.

Since upgrading to v2.3.5 I have also had to adjust several timeouts in order to make things work, what used to be 500ms or 1second timeouts have had to be raised to 3 second time outs.

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

Re: picture accessible descriptions not working properly

Post by Support Team » Fri Dec 17, 2010 2:42 pm

The highlighting issue is that the element is still cached by Ranorex, and for some reason stays valid and visible, so it is re-used (only for highlighting, because searching is sometimes slow). This is a UI glitch and should not in any way break your automation scripts; If you use Spy with the copied absolute path, it should display the "fresh" element. Another workaround is changing the path in the repository (and changing it back), then the cache is flushed.

Regarding the timeouts, could you post an example or could you describe the scenario where you had to change the timeouts ?

Michael
Ranorex Team
.
Image