Absolute Click

Ask general questions here.
WesleyWest
Posts: 5
Joined: Thu Feb 28, 2019 3:00 am

Absolute Click

Post by WesleyWest » Thu Oct 10, 2019 2:07 pm

I am having issues with seeing a check box so it can be clicked.

This is a grid with headers
Currently what we do in a recording is
Get the Column: Searches the header for the name we select. In this case it's "Warehouse" (rawtext[@rawtext='Warehouse'])
Get the Row: We need to figure out which row based on the user which is the first column. In this case it's a variable. (rawtext[@column=$Column and @rawtext=$AssignedUser]
We then combine the 2 to either validate or click. (rawtext[@column=$Column and @row=$Row])

This works great in multiple situations and we use it a lot. It will find the row based on a user defined by a variable and the column based on the header name.

However, sometimes we have situations where there is a check box or a empty field and the repository doesn't find the cell. In the situation that brought on this post we need to click a checkbox that is either checked or unchecked but ranorex doesn't see it so it wont click.

My question is: I want to be able to click on a absolute position that doesn't rely on anything other than column + row.


Any help would be appreciated

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

Re: Absolute Click

Post by odklizec » Thu Oct 10, 2019 2:14 pm

Hi,

Please upload a Ranorex snapshot (NOT screenshot) of the UI, showing the problematic situation. It's hard to suggest something reliable without seeing, at very least, Ranorex snapshot.

RAW text-based automation is quite tricky. So it there is no other way how to detect certain UI element, you will most probably have to use image-based automation? But as mentioned, it's hard to tell for sure, without seeing the snapshot. Thanks.
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

WesleyWest
Posts: 5
Joined: Thu Feb 28, 2019 3:00 am

Re: Absolute Click

Post by WesleyWest » Thu Oct 10, 2019 2:23 pm

Sorry about that, I attached it to this post.

Thanks!
Attachments
GridSnapshot.rxsnp
(30.66 KiB) Downloaded 2 times

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

Re: Absolute Click

Post by odklizec » Fri Oct 11, 2019 7:47 am

Hi,

You can, of course, use absolute coordinates in Click action. Unfortunately, there appears to be no way to tell, if the checkbox is checked or not. Plus the position of checkbox you want to click can be only assumed, based of selected header cell coordinates? For example, if you get coordinates (client rectangle) of column Warehouse, you will see this:
Warehouse_Coord.png
Warehouse_Coord.png (91.58 KiB) Viewed 61 times
With this you know the position and size of Warehouse column...
x=227, y=5, w=51, h=17
And belonging checkbox is right under it. So all you have to do, is to change the Y position of obtained header element, with its Y value + height of header cell + some overhead (e.g. +5 pixels?). This should give you position of cell with checkbox...
x=227, y=27, w=51, h=17
And then you need to calculate center of this cell, where...
x=227+(51/2)
y=27+(17/2)
This should give exact center of checkbox cell, which belongs to Warehouse column. 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

McTurtle
Posts: 263
Joined: Thu Feb 23, 2017 10:37 am
Location: Benedikt, Slovenia

Re: Absolute Click

Post by McTurtle » Fri Oct 11, 2019 7:51 am

Hello WesleyWest,

odklizec is exactly right with the coordinates.

Once you have the coordinates of the checkbox, you could expand that to a range and use image based automation in order to verify if the section contains a image of a checked or un-checked checkbox. This is not very easy, but I don't really see a different way.

Regards,
McTurtle