Move to element which is not visible

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
Aswini
Posts: 13
Joined: Tue Jun 03, 2014 2:49 pm

Move to element which is not visible

Post by Aswini » Tue Jun 10, 2014 7:53 am

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

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Move to element which is not visible

Post by Support Team » Thu Jun 12, 2014 2:38 pm

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

Aswini
Posts: 13
Joined: Tue Jun 03, 2014 2:49 pm

Re: Move to element which is not visible

Post by Aswini » Fri Jun 13, 2014 8:42 am

Hi,

Thanks for the reply...

Please find the snapshot of the app.

Thanks,
Aswini
You do not have the required permissions to view the files attached to this post.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Move to element which is not visible

Post by Support Team » Mon Jun 16, 2014 4:24 pm

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

Aswini
Posts: 13
Joined: Tue Jun 03, 2014 2:49 pm

Re: Move to element which is not visible

Post by Aswini » Wed Jun 18, 2014 7:03 am

Thanks for the suggestion Markus. Will be working with Image based automation.

Regards,
Aswini

Aswini
Posts: 13
Joined: Tue Jun 03, 2014 2:49 pm

Re: Move to element which is not visible

Post by Aswini » Mon Jul 14, 2014 11:37 am

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

Tnimni
Posts: 49
Joined: Thu Jan 02, 2014 4:03 pm

Re: Move to element which is not visible

Post by Tnimni » Mon Jul 14, 2014 7:26 pm

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