Ability to programmatically detect a text under mouse pointer

Ask general questions here.
EugeneMkv
Posts: 29
Joined: Thu Nov 30, 2017 3:52 pm

Ability to programmatically detect a text under mouse pointer

Post by EugeneMkv » Thu Nov 15, 2018 9:28 pm

Hello everyone,

Suppose we have a huge dynamic grid with a lot of rows. And in one scenario we need to click some cells in one particular column of data.
But there is one condition: if the cell is empty or has 0 value - we should shift mouse cursor to the next position and click that one (if the earlier condition is met).
Is there a way to programmatically detect the value under the mouse pointer? Kind of the Track function of Spy which works in code and returns Text or Caption attribute value? Is it possible?

ps. detecting all the values in the grid and searching for the right cells takes a lot of time.

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

Re: Ability to programmatically detect a text under mouse pointer

Post by odklizec » Thu Nov 15, 2018 9:37 pm

Hi,

Almost anything is possible with Ranorex ;) Could you please upload a Ranorex snapshot (NOT screenshot) of the problematic table and example xpath to the cell in question? Without, at very least, Ranorex snapshot, it’s very hard to suggest a sensible solution.
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

EugeneMkv
Posts: 29
Joined: Thu Nov 30, 2017 3:52 pm

Re: Ability to programmatically detect a text under mouse pointer

Post by EugeneMkv » Fri Nov 16, 2018 1:06 am

Hi odklizec,

There is no problematic table. There is a table with many rows of data (each row contain many many cells). I need a way to detect a cell value (Text) right at the mouse pointer (in order to avoid getting all the rows because it's very long operation) to be able to shift mouse pointer to another cell (if this particular cell is empty or 0).

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

Re: Ability to programmatically detect a text under mouse pointer

Post by odklizec » Fri Nov 16, 2018 9:05 am

Hi,

But how do you know the mouse is above a cell at all? I mean, you still have to use xpath to detect the table/its cells and move the mouse above table. And in this case, it's much easier (and correct) to use xpaths to detect elements. The thing is, that Ranorex is not detecting "things under mouse". Ranorex identifies elements based of their xpaths. I'm sure it's possible to detect (via code) if mouse is right above an element. But still, you will have to use xpath to detect the particular element. In my opinion, your approach is not effective and I believe there is a better way to achieve what you want via Ranorex xpaths. This is what I've asked for snapshot.
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

EugeneMkv
Posts: 29
Joined: Thu Nov 30, 2017 3:52 pm

Re: Ability to programmatically detect a text under mouse pointer

Post by EugeneMkv » Fri Nov 16, 2018 10:00 am

But how do you know the mouse is above a cell at all?

In this scenario to speed up the process I don't use xPath of the cells in the grid. I only use a column header name (detected by xPath very quickly) and click relative to this particular header. The click happens outside the element border but its not the problem in this case.

The thing is, that Ranorex is not detecting "things under mouse".

Yes it is detecting! You forgot Live tracking mode when you point some element with a mouse and then click WIN+CTRL.
I need to use this function programmatically: detect a cell under mouse and then get its Text attribute.

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

Re: Ability to programmatically detect a text under mouse pointer

Post by odklizec » Fri Nov 16, 2018 10:55 am

Hi,

I'm afraid, LiveTracking is something completely different, and I'm not aware of any such functionality publicly available in Ranorex. I mean usable in recordings or user code. And in my opinion, it's not a good way to go anyway. Automatic tests are about consistency, not about the speed of playback. And this is what the xpaths are for. To make the element recognition stable and consistent. Detecting "something" under mouse, without precise identification of element, is sure way to mess and inconsistent behaviors. Just my two cents ;)
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

EugeneMkv
Posts: 29
Joined: Thu Nov 30, 2017 3:52 pm

Re: Ability to programmatically detect a text under mouse pointer

Post by EugeneMkv » Fri Nov 16, 2018 12:21 pm

Automatic tests are about consistency, not about the speed of playback.

The speed of playback is critical when we automate smoke tests which run every time a new build is done.

Detecting "something" under mouse, without precise identification of element, is sure way to mess and inconsistent behaviors.

I can't agree with you. Because in some cases this is the best way to implement some tasks (especially in huge grids).
Thanks for your opinion!