Robot framework Ride : get value of an attribute

I work with robot framework with RIDE development environment for a desktop application, I would like to get the value of element

The attribute has an ID : NeedSupervisorConfirmationPortrait

I want to retrieve the value of the TogglePattern.toggleState of the attribute that has ID:NeedSupervisorConfirmationPortrait

image

It is not relevant the IDE you use.
The important thing is what Library you are using or planning to use.

For desktop testing, in you case Windows, you want a Library that ā€œknowsā€ the internals of the system.
I have ā€œheardā€ of White Library, but I never used it (and seems to be too old).

I use image recognition Library, SikuliLibrary, which does not ā€œknowā€ about system internals.

FYI I believe Robotframework-FlaUI is the replacement to White Library, it adds support for metro apps in addition to what White Library did. I only used it once a couple of years ago but it worked well for me.

There is also robotframework-imagehorizonlibrary which is similar to SikuliLibrary, imagehorizon is pure python where as SikuliLibrary is Java based. I submitted some bug fixes PRā€™s for imagehorizon but there has been no update since, so iā€™m not sure if imagehorizon is being maintained?

Dave.

1 Like

Hello,

Thank you for your answers,

Yes I already use the WhiteLibrary and SikuliLibrary but I canā€™t get the value of a specific attribut if I give an ID for example

In web applications there is the library Selenium2Library with Get Element Attribute function which can retrieve the value of the attribute, is there another library for the desktop application?

Hajer

Hi Ben,

White Library has keywords such as Get Text From Label and Get Text From Textbox and similar, these wonā€™t give you field attributes but at least give you visible text.

SikuliLibrary and imagehorizonLibrary also have to keywords for getting data but they are essentially limited to double clicking at x,y co-ordinates and copying to the clipboard or doing OCR of a region of the screen to get the text

None of these libraries can give you the level that a library such as SeleniumLibrary can, however if you know the what development framework the application was built with you may be lucky and find a library that works with that development framework and can interrogate that application and give you more detail.

Dave.

Hi @Hajer

What you could try as rightly soā€¦ Whitelibrary doesnā€™t have the means to grab those property values but as part of your testā€¦ you could try to grab that ā€˜attributeā€™ property value, is to ā€˜Activate Applicationā€™ Accessibility Insights For Windows (you can switch off always on top so itā€™s not covering any windows so it never sits on top), and when you come to that element you need that property value for, you could then send the key press for the shortcut to start/pause for Accessibility Insights, then bring to front (I believe thereā€™s a shortcut for this too) then grab that value from the properties section from Accessibility insights, once captured pause/close Accessibility Insights.

You should be able to use two instances of Accessibility Insights, one paused and one active to get the steps needed to automate that windows elementā€™s property valueā€¦ or if two instances cause problems (you could use the legacy inspect tool as an alternative and Accessibility Insights together).

Just an ideaā€¦ feels a little dirty to piggyback off the back of that applicationā€¦ let me know if it works though, or if you find a way to get the property values by other means.

1 Like

It is a desktop application is developed with WPF in .NET in xml

It is a desktop application is developed with WPF in .NET in xml

Hi Ben,

In that case robotframework-flaui is probably your best bet.

Iā€™d suggest before you start trying to use robotframework-flaui try downloading FlaUI Inspect (link from the robotframework-flaui page) as this tool will firstly let you know if robotframework-flaui can interact with the elements of your app, and second youā€™ll probably want this tool anyway when you want to find the field idā€™s to automate the application.

If FlaUI Inspect canā€™t find the elements of your app then youā€™ll have saved youself installing robotframework-flaui and know you need to try something else.

Dave.

1 Like