Page 1 of 1

Move to element which is not visible

Posted: Tue Jun 10, 2014 7:53 am
by Aswini
Hi,

I've requirement to move to a specific element and click it.
In the visible portion of a screen, 12 thumbs will be displayed. If there are more elements we need to scroll down. Now i need to write code when to scroll.
I've used Ensure Visible, Visible and Exists to check the elements is present in the visible portion. unfortunately all are returning "true". If i call mouse moveto element, it is giving exception.

Can you please help me how to find the element in visible portion and then scroll down if not visible.

Thanks,
Aswini

Re: Move to element which is not visible

Posted: Thu Jun 12, 2014 2:38 pm
by Support Team
Hi Aswini,

May I ask you to post or send us (to [email protected]) a Ranorex snapshot file of the elements, including the ones which are in the invisible area?
The following link will show you how to generate a snapshot file: Creating Ranorex Snapshot Files.

Thanks,
Markus

Re: Move to element which is not visible

Posted: Fri Jun 13, 2014 8:42 am
by Aswini
Hi,

Thanks for the reply...

Please find the snapshot of the app.

Thanks,
Aswini

Re: Move to element which is not visible

Posted: Mon Jun 16, 2014 4:24 pm
by Support Team
Hi Aswini,

It seems as if the controls which are not visible are explicitly set to visible=true in code even though they are not in the visible area. It also seems as if the first container "/dom[@domain='review-ikea.ecbook.se']/?/?/flexobject[@id='rpc']/container[@displayname='instance3']" is also explicitly set to wrong dimensions, the Width is 4239 and the Height is 2177 even though the parent root flex element has other dimensions Width 1440 and Height 741.
You therefore need to find another way to distinguish if an element is visible or not.
This could be done by using Image Based methods or by using the y- coordinates of the not visible elements.
To get the values of the elements you can use the following code:
Point point = yourRepoElement.Element.ScreenLocation;
Regards,
Markus

Re: Move to element which is not visible

Posted: Wed Jun 18, 2014 7:03 am
by Aswini
Thanks for the suggestion Markus. Will be working with Image based automation.

Regards,
Aswini

Re: Move to element which is not visible

Posted: Mon Jul 14, 2014 11:37 am
by Aswini
Hi,

I'm facing issue with clicking element which is not in visible screen.
And this element is visible to Ranorex but it is unable to move to element and click it.
I've tried by checking Enabled, Visible, Ensure Visble, Exists but all of these are returning TRUE.
Actually, the element I'm trying to click is not the direct repository element.
I've taken the repository path of the image grid container and access the children in it based on the condition.
I've tried checking with below condition which is returning true even if the element is not in the visible screen:
repo1.HostPath.TopbarContainer.Bookmark_Icon_TOC.ScreenRectangle.Contains(repo1.HostPath.TopbarContainer.Bookmark_Icon_TOC.Children[i-1].Element.ScreenRectangle

TopbarContainer.Bookmark_Icon_TOC contains few image containers and I need to verify the children elements in it . How can i make Ensure Visible as false for the children elements(based on few suggestions in forum).

How can i verify whether the element is in the visible screen or not and how to click it?
Note: I'm using Ranorex version -- 5.1

Thanks,
Aswini

Re: Move to element which is not visible

Posted: Mon Jul 14, 2014 7:26 pm
by Tnimni
Aswini wrote:Hi,

I've requirement to move to a specific element and click it.
In the visible portion of a screen, 12 thumbs will be displayed. If there are more elements we need to scroll down. Now i need to write code when to scroll.
I've used Ensure Visible, Visible and Exists to check the elements is present in the visible portion. unfortunately all are returning "true". If i call mouse moveto element, it is giving exception.

Can you please help me how to find the element in visible portion and then scroll down if not visible.

Thanks,
Aswini
Hi,

If i understand currectly the solution is simple.

what you need to do is:
1. check if there are more than 12 elemnts on the screen
2. if there are more than 12, scroll down

You can do that by using Ranorex FindDescendants<T> Method, which returns IList.
Than do IList.Count and if the value is >12 you can scroll :)

Good luck

Any more questions please PM me