print the properties of elements when i track during Runtime

Ask general questions here.
Sai
Posts: 22
Joined: Tue Jul 18, 2017 10:59 am

print the properties of elements when i track during Runtime

Post by Sai » Wed Jul 19, 2017 6:16 am

Hello Ranorex Users,

I am Sai, workring with Ranorex fast few years.

I got one scenario from client and don't know how Ranorex fit for this scenario. Please find the requirements is the following.

In the manual process I follow the steps which are
1. Open Ranorex Spy
2. Click on Track
3. Click on any button in an application
4. Ranorex spy gives me the information/properties of the button I clicked like image or text, size of rectangle etc
I want to do the above in an automated way which is
1. Whenever I click the left mouse button wherever in the screen or in an application
2. Capture the details of what I clicked
Note: During run time, i will track the elements by spy tool, at the same time Ranorex must take the properties of selected element (where i click on app) and report it.

Let me know if you require more information.

Any reply appreciable.

Thanks in advance.
Sai

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3908
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: print the properties of elements when i track during Runtime

Post by odklizec » Wed Jul 19, 2017 2:15 pm

Hi,

I will just repeat what I suggested via PM...
I don't think there is a way to achieve this with Ranorex spy. The only possibility could be using Spy, together with another tool (like AutoIt), with which you can read the Spy properties and save them to file (or do whatever you want with them). This must be done in a loop. This is the only way I can currently think of.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

asdf
Posts: 174
Joined: Mon Mar 21, 2016 3:16 pm

Re: print the properties of elements when i track during Runtime

Post by asdf » Thu Jul 20, 2017 11:30 am

Hi Sai,

Unfortunately, it is not possible to achieve your intention. However, there is a similar approach, which allows you to get all properties of an element during runtime, using its RxPath. Please take a look at the following lines of code.

Code: Select all

Element myButton = "<RanoreXPath>";
foreach (var attr in myButton.Role.Attributes)
{
    Report.Info("Attribute: " + attr);
    Report.Info("Value: " + myButton.GetAttributeValueText(attr.Value.ToString()));
}
foreach (var cap in myButton.Capabilities)
{
    foreach (var attr in cap.Attributes)
    {
        Report.Info("Attribute: " + attr.Value.ToString());
        Report.Info("Value: " + myButton.GetAttributeValueText(attr.Value.ToString()));
    }
}
foreach (var attr in myButton.DynamicCapability.Attributes)
{              
    Report.Info("Attribute: " + attr);
    Report.Info("Value: " + myButton.GetAttributeValueText(attr.Value.ToString()));            
}  
Hope this helps.

Regards,
asdf