Technology specific object identification, supported applications, web technologies, and 3rd party controls.
-
aravin
- Posts: 47
- Joined: Mon Mar 09, 2015 7:43 am
Post
by aravin » Tue Jun 16, 2015 8:31 am
Hi Team,
I want to find the elemnt from the visible area of the desktop! How to get the visible element alone?
Find the attachment below for better understanding.

- Visible Area
- image00.png (9.86 KiB) Viewed 1283 times
Methods I followed,
1. Foreach
Code: Select all
IList<Container> tocThumbList=repo.appName.toc.tocContainer.FindChildren<Container>();
foreach(var tempThumb in tocThumbList)
{
if(tempThumb.Element.GetAttributeValueText("Caption")=="46-47" && tempThumb.Element.Visible)
{
tempThumb.Click();
Report.Info("Element Found...");
}
}
2. For Each loop.
Same code with foreach loop.
------------------
Currently this code is getting all the thumbnails from the container, which are not visible in the desktop screen.
Is there any alternative solution to find and click the elemnt which are visible in this current screen. It should not find the hidden thumbnail.
Thanks in advance.

-
odklizec
- Ranorex Guru

- Posts: 6360
- Joined: Mon Aug 13, 2012 9:54 am
- Location: Zilina, Slovakia
Post
by odklizec » Tue Jun 16, 2015 9:19 am
Hi,
As I mentioned in your
other post on this subject, to find if the element is outside the visible area of screen you will most probably have to calculate it from screen resolution (desktop size) and element position on desktop. If the element position is outside the screen resolution/desktop size, it's clearly in non-visible area of desktop
However, I think EnsureVisible() should do the trick and bring the element to visible area of screen.
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
Post
by aravin » Tue Jun 16, 2015 9:39 am
Hi,
I am already using EnsureVisible(). It is not working.
-
odklizec
- Ranorex Guru

- Posts: 6360
- Joined: Mon Aug 13, 2012 9:54 am
- Location: Zilina, Slovakia
Post
by odklizec » Tue Jun 16, 2015 9:44 am
Even after disabling the mouse option I mentioned in second post? In this case, your only chance is to get the thumbnail position and compare it with desktop area/screen resolution.
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
Post
by aravin » Wed Jun 17, 2015 7:15 am
Hi Odklizec,
Thanks a lot.
Old Code
Code: Select all
if(tempThumb.Element.GetAttributeValueText("Caption")==thumbName )
New Code
Code: Select all
if(tempThumb.Element.GetAttributeValueText("Caption")==thumbName && repo.browserScreen.Self.ScreenRectangle.Contains(tempThumb.Element.ScreenLocation)
This worked for me.
I have taken the browser screen rectangle size and verified that the thumb element position before clicking the element.
-
odklizec
- Ranorex Guru

- Posts: 6360
- Joined: Mon Aug 13, 2012 9:54 am
- Location: Zilina, Slovakia
Post
by odklizec » Wed Jun 17, 2015 7:23 am
Hi,
You are welcome. Nice to hear you solved the problem.
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