Have to perform Click(). Only if elemnt visible in desktop

Ranorex Spy, Recorder, and Studio.
aravin
Posts: 47
Joined: Mon Mar 09, 2015 7:43 am

Have to perform Click(). Only if elemnt visible in desktop

Post by aravin » Mon Jun 15, 2015 8:36 am

Hi,

I need to find & click the elemnt from the list of thumbnail.

Some thumbnails are not visible in screen, but it perform

Code: Select all

thumb.Foucs
and

Code: Select all

thumb.Visible
it return the "true".

But when I try to click the element it shows error.

So How to click the element only if it is visible in the screen, otherwise have to skip that

Code: Select all

Click()
and continue the next step?[/b]

Thanks in advance.

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

Re: Have to perform Click(). Only if elemnt visible in desktop

Post by odklizec » Mon Jun 15, 2015 8:59 am

Hi,

Could you please post a screenshot of your desktop and also Ranorex snapshot of the thumbnail in question? If the thumbnail is not visible on desktop but Ranorex spy returns Visible = true, then it's weird. Could it be that the thumbnail in question is somewhere outside the visible area of screen? Could you reproduce this problem with something windows specific (e.g. create a thumbnail for Calculator and place it on desktop).

Anyway, you will have to use code to achieve what you want. It's currently not possible to perform logical operations from recording. But if visible attribute always returns true, you will have to find another way how to make the sure the thumbnails is visible/accessible for click. As mentioned, screenshot and snapshot would be extremely helpful here ;)
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

aravin
Posts: 47
Joined: Mon Mar 09, 2015 7:43 am

Re: Have to perform Click(). Only if elemnt visible in desktop

Post by aravin » Tue Jun 16, 2015 6:52 am

Thanks man. Is there any logic from your end?

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

Re: Have to perform Click(). Only if elemnt visible in desktop

Post by odklizec » Tue Jun 16, 2015 8:09 am

Hi,

Logic in what? Have you tried the steps from my previous post?
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

aravin
Posts: 47
Joined: Mon Mar 09, 2015 7:43 am

Re: Have to perform Click(). Only if elemnt visible in desktop

Post by aravin » Tue Jun 16, 2015 8:34 am

Yes.

I can reproduce same issue.

It is common. You can find in any application that contain list of thumbnail.. Try to click the thumbnail which is out the desktop. It will show the error message.

"Element is outside the desktop screen...."

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

Re: Have to perform Click(). Only if elemnt visible in desktop

Post by odklizec » Tue Jun 16, 2015 9:02 am

You may try to uncheck this setting option...
MousePointer.png
MousePointer.png (6.34 KiB) Viewed 884 times
Another thing you might try is using EnsureVisible method, which tries to bring the element to visible area of screen.

Code: Select all

repo.elementname.EnsureVisible();
Anyway, think the only way how to detect if the thumbnail is outside the visible area of desktop, is to get the monitor resolution (I'm sure there is a system function for this?), size of desktop (from repo element attributes), get the coordinates of thumbnails (from repo element attributes) and then calculate if the thumbnail coordinates are within the visible area of desktop. Check for example this post:
http://www.ranorex.com/forum/how-to-hor ... t3311.html
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