How do I get the Text values of these items?

Ask general questions here.
Filipe Mendes
Posts: 19
Joined: Tue Jul 16, 2019 3:24 pm

How do I get the Text values of these items?

Post by Filipe Mendes » Wed Nov 27, 2019 8:12 pm

Hi,

I have a tooltip that I managed to find the path.
But now how do I get the values when it appears of its elements?
Here is a screen shot to the container in question.

Filipe Mendes
Posts: 19
Joined: Tue Jul 16, 2019 3:24 pm

Re: How do I get the Text values of these items?

Post by Filipe Mendes » Wed Nov 27, 2019 8:15 pm

Here is the screenshot.

Thanks in advance for your help.
You do not have the required permissions to view the files attached to this post.

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

Re: How do I get the Text values of these items?

Post by odklizec » Wed Nov 27, 2019 9:14 pm

Hi,

Please post a Ranorex snapshot. Screenshot is unfortunately useless for element evaluation.
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

Filipe Mendes
Posts: 19
Joined: Tue Jul 16, 2019 3:24 pm

Re: How do I get the Text values of these items?

Post by Filipe Mendes » Wed Nov 27, 2019 10:53 pm

snapshot test sent.

Thanks,

Filipe
You do not have the required permissions to view the files attached to this post.

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

Re: How do I get the Text values of these items?

Post by odklizec » Thu Nov 28, 2019 8:02 am

Hi,

Thanks. Now please post the xpath ;) And what exactly you want to achieve? Get the list of texts and then what?
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

Filipe Mendes
Posts: 19
Joined: Tue Jul 16, 2019 3:24 pm

Re: How do I get the Text values of these items?

Post by Filipe Mendes » Thu Nov 28, 2019 4:03 pm

Hi Odlizec,

We have an application that is currently in development.
Every time there is a new build, we have a process that installs the new release and does a bunch of test that are performed with Ranorex that include:
-Login into the application
-Verify some menu, popups and so on

Now I would like to add some more verification tests in the Automation with Ranorex and one of them is:
-When the mouse hovers on a the Graphic card item a Tooltip is supposed to display information about the graphic card
And that is what I would like to get.

This is the xpath:

/form[@title='CyTOF Software']/container[@caption='']/container[2]/element[@automationid='DockSite']/?/?/element[@automationid='PART_DockHost']/element/?/?/container[@automationid='PART_ContentHost']/?/?/container[@automationid='PART_Panel']/container[3]//container[@automationid='childContentPresenter']/?/?/container[@caption='']/element/container[@caption='']/container[@caption='']/container[@caption='']

And inside this I have several text items, for example the complete xpath to an item would be:
/form[@title='CyTOF Software']/container[@caption='']/container[2]/element[@automationid='DockSite']/?/?/element[@automationid='PART_DockHost']//container[@automationid='PART_ContentHost']/?/?/container[@automationid='PART_Panel']/container[3]//container[@automationid='childContentPresenter']/?/?/container[@caption='']/element/container[@caption='']/container[@caption='']/container[@caption='']/text[@caption>'Global Cache Size: -1768']

And what I need in this case above is the value : lobal Cache Size: -1768...

Thanks,

Filipe

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

Re: How do I get the Text values of these items?

Post by odklizec » Thu Nov 28, 2019 4:13 pm

Hi,

Well, since the individual texts in the container does not have unique IDs, you will have to use their texts. So for example, this path will return text element Global Cache Line Size:

Code: Select all

/form[@title='CyTOF Software']//container[@automationid='PART_ContentHost']/?/?/container[@automationid='PART_Panel']//text[@caption~'Global Cache Line Size:']
And then, if you want to check/validate the value behind ':', you should simple use GetValue with regex like this (obtains value behind ':' and ignores spaces):

Code: Select all

[^:\s]+$
Hope this helps?
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

Filipe Mendes
Posts: 19
Joined: Tue Jul 16, 2019 3:24 pm

Re: How do I get the Text values of these items?

Post by Filipe Mendes » Thu Nov 28, 2019 4:21 pm

Hi,

Above, I meant the value of "Global Cache Size" that is "-1768...".
And in this case my application should raise a warning because that value should not be negative.

Thanks,

Filipe

Filipe Mendes
Posts: 19
Joined: Tue Jul 16, 2019 3:24 pm

Re: How do I get the Text values of these items?

Post by Filipe Mendes » Thu Nov 28, 2019 4:28 pm

Thanks. I ll try this and get back to you.
I think above we post at exactly the same time

Filipe Mendes
Posts: 19
Joined: Tue Jul 16, 2019 3:24 pm

Re: How do I get the Text values of these items?

Post by Filipe Mendes » Thu Nov 28, 2019 9:39 pm

Hi,

I am getting the element using the XPATH you posted above.
However, when I add GetValue as new action it seems impossible to extract the final value .
I have tried all options that come with GetValue:
-Caption
-SelectionLenght
-SelectionStart
-SelectionText
-Text


But nothing works
Thanks,

Filipe

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

Re: How do I get the Text values of these items?

Post by odklizec » Thu Nov 28, 2019 10:33 pm

Hi,

What exactly the GetValue returns? And have you applied the regex I suggested ?
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

Filipe Mendes
Posts: 19
Joined: Tue Jul 16, 2019 3:24 pm

Re: How do I get the Text values of these items?

Post by Filipe Mendes » Thu Nov 28, 2019 11:28 pm

The error I am getting is :The element does not support the required capability 'text' when I use GetValue

Filipe Mendes
Posts: 19
Joined: Tue Jul 16, 2019 3:24 pm

Re: How do I get the Text values of these items?

Post by Filipe Mendes » Thu Nov 28, 2019 11:37 pm

Yes I did apply the Regex

Filipe Mendes
Posts: 19
Joined: Tue Jul 16, 2019 3:24 pm

Re: How do I get the Text values of these items?

Post by Filipe Mendes » Thu Nov 28, 2019 11:49 pm

-The Automation hovers over the Item so the Tooltip can be displayed
-The user code validates that the element is visible
public void getGlobalCacheValue(RepoItemInfo globalCacheItem)
{

if (globalCacheItem.Exists()){
Report.Info("Global Cache does exist");

}
else{
Report.Info("Could not find Global Cache");
}

}
Which is "Text 'Global Cache Size: -1768570880'"
-And from that I want to retrieve only the value "-1768570880" to make sure I am retrieving the correct one



Thanks,
You do not have the required permissions to view the files attached to this post.

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

Re: How do I get the Text values of these items?

Post by odklizec » Fri Nov 29, 2019 8:19 am

Hi,

Well, that's weird. The snapshot clearly shows the given text in Text, Caption and Selection Text attributes. But I see you are using an old 9.1.0, while the most recent Ranorex version is 9.2.0. And since there were done couple of WPF-related bug fixes, you should really consider updating your exisitng Ranorex version.

Anyway, I just noticed that the Text itself contains couple of containers! And in one of them, you can get the value of cache size, without messing with regexes! Just try to get the value (without regex) from this element (from Text attribute):

Code: Select all

/form[@title='CyTOF Software']//container[@automationid='PART_ContentHost']/?/?/container[@automationid='PART_Panel']//text[@caption~'Global Cache Line Size:']/container[@name='OpenCLGlobalCacheLineSize']
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