Page 1 of 1

Why Ranorex does't support ScrollIntoView?

Posted: Tue Sep 10, 2013 10:00 am
by sincoew
Hi,

I need to dynamic search UI Element at grid/list/table view,
In Metro app, I can use scrollintoview to invoke element,
but in Ranorex Api, I can't find this function,
How can I do?

Code: Select all

http://msdn.microsoft.com/en-us/library/system.windows.automation.scrollitempattern.scrollintoview(v=vs.100).aspx
Thanks a lot.
Best Regards,
Sincoew

Re: Why Ranorex does't support ScrollIntoView?

Posted: Wed Sep 11, 2013 3:50 pm
by Support Team
Hello Sincoew,

the scrollIntoView() method is used internally in the EnsureVisible() method in Ranorex.
Please try to use this method.

Regards,
Bernhard

Re: Why Ranorex does't support ScrollIntoView?

Posted: Thu Sep 12, 2013 3:41 am
by sincoew
Hi Bernhard,
Thanks you for your reply,

But in Metro, I can use below method get all element,
Even the element is not in the view,
I also can use "ScrollIntoView" to invoke this element into view.

---------Metro------------

Code: Select all

TreeWalker _walker=TreeWalker.RawViewWalket;
Element = _walker.GetfirstChild(GridView);
while(Element!=null)
{
  Element.ScrollIntoView();
  Element = _walker.GetNextSibling(Element);
}
---------------------------
But in iPhone, I can not use table.child[i+1].scrollintoView to get all element in table.
and I use

Code: Select all

 Node.Element.Parent.InvokeActionWithText("ScrollTable", i.ToString(), j.ToString()); 
to invoke element in to view, but I don't know which child[index] is my target?
tempID can't use and some time Child[index] not match on visual UI.
(Because table generate the element is dynamic in iPhone)

Now I use Compare to record which Element is not in my list.
But performance is not good.

Has any function or method can search all Table child element,
event the element not in view?
(I also try EnsureVisible() on iPhone.Table.child.element, but this function not same with Metro scrollIntoView)

Thanks a lot,
Best Regards,
sincoew

Re: Why Ranorex does't support ScrollIntoView?

Posted: Fri Sep 13, 2013 1:40 pm
by Support Team
Hello,

Unfortunately it is not possible to use "ScrollIntoView" in iOS.
You can use "ScrollTable" instead. Pleae take a look into our online API documentation which can be found using the following link: http://www.ranorex.com/Documentation/Ranorex/

Regards,
Bernhard

Re: Why Ranorex does't support ScrollIntoView?

Posted: Tue Oct 29, 2013 9:31 am
by sincoew
Hi Bernhard,

Does Ranorex can support ScrollIntoView() in iOS/Android at future?
(Not "ScrollTable")

Thanks a lot,
Best Regards,
sincoew

Re: Why Ranorex does't support ScrollIntoView?

Posted: Thu Oct 31, 2013 1:32 pm
by Support Team
Hello sincoew,

I am afraid that this is not that easy to realize. Why is ScrollTable not working for you?

Regards,
Bernhard

Re: Why Ranorex does't support ScrollIntoView?

Posted: Thu Oct 31, 2013 2:01 pm
by sincoew
Hi Bernhard,

I need to get table all dynamic content information in iPad,

for example:
-------------------------------------------------------
[UI_View]
[item-A] -> get info
[item-B] -> get info
[UI_View]
[item-A] -> get info
[item-B] -> need scroll Table -> Do scroll Table
[item-C]
...
[item-Z]
-------------------------------------------------------
Which item I already get info ?
[UI_View]
[UI_View]
[item-B]
[item-C]
[item-C]
...
[item-Z]
--------------------------------------------------------

or have any function can do "GetNextSibling" on table item?
I need to get all table item info, to verify table item is load content on correct.

Best Regards,
Sincoew

Re: Why Ranorex does't support ScrollIntoView?

Posted: Wed Nov 06, 2013 10:14 am
by Support Team
Unfortunately currently it is not possible to get all the cells in a UITableView in a simple way.

iOS is the latest technology supported by the Ranorex system. Therefore the automation capabilities for this technology are not as mature as for the other technologies supported by Ranorex yet. Especially the automation support for collection based controls (UIPickerView, UITableView, UICollectionView) is limited at the moment.

Better support for these controls is one of our top priorities at the moment and we are currently implementing this feature. It is very likely the automation capabilities regarding these controls will be much better with the next release including new features (Minor release).

The reason checking for all cells in a table currently is not possible in a simple way is, that Ranorex only analyzes the UI structure of the UITableView. So Ranorex doesn't know about cells that are not displayed on the screen (as these cells are not part of the UI hierarchy).

Currently you should be able to validate all cells in a table by doing so in user code by using the following code fragment:

Code: Select all

var adapter = repo.App.MyTable.As<IosTable>();
int sections = adapter.NumOfSections;
int rowsPerSection = adapter.NumOfRowsPerSection;
for(int s = 0; s < sections; s++)
{
	for(int r = 0; r < rowsPerSection; r++)
	{
		adapter.ScrollTable(s, r);
		
		//Validation logic here...
	}
}
Does Ranorex can support ScrollIntoView() in iOS/Android at future?
Please note that ScrollIntoView() is a WPF/XAML specific functionality and will not be supported by iOS in the future.

Regards,
Philipp

Re: Why Ranorex does't support ScrollIntoView?

Posted: Thu Nov 07, 2013 4:22 am
by sincoew
Hi Philipp,

Thanks you for your reply,

Now I'm use like for loop method to get all element info.
But has some bug when UI is Change.

In another question, Can ScrollTable do return the "Element" or "Adapter" after scroll table?

Code: Select all

Element = adapter.ScrollTable(s, r);
//Element is equal "Table.Child[s, r]" element before scrolled.
//I need to know which element is I scrolled, because sometime scrolled element not on first item.
Thanks you for your help.
Best Regards,
Sincoew

Re: Why Ranorex does't support ScrollIntoView?

Posted: Thu Nov 07, 2013 3:36 pm
by Support Team
sincoew wrote:In another question, Can ScrollTable do return the "Element" or "Adapter" after scroll table?
Unfortunately this is not possible at the moment. As already said we only examine the UI representation of the table. What exactly happens when ScrollTable is invoked is determined by iOS (e.g. the ScollTable function cannot scroll beyond the table bounds so especially when you are at the end of the table there is no guarantee that the first view contained in the table is the item, that was specified in the ScrollTable call).

I will try to make my code example a little bit more clear to show you how you can validate that an item exists in the table. Please note that this is some kind of work around for the problem you're describing. Due the limited support of collection based views, this complex solution is required and as already said we're working hard, to improve the automation experience in this area with future Ranorex versions.

Code: Select all


string[] toValidateTheyExist = { "ItemA", "ItemB", "ItemC", "ItemD" };
foreach(var tvte in toValidateTheyExist)
{
  bool wasFound = false;
  
  var adapter = repo.App.MyTable.As<IosTable>();
  int sections = adapter.NumOfSections;
  int rowsPerSection = adapter.NumOfRowsPerSection;
  
  for(int s = 0; s < sections; s++)
  {
     for(int r = 0; r < rowsPerSection; r++) //to speed up the test r++ ca be replaced by r += numOfItemsOnScreen - Constant
     {
        adapter.ScrollTable(s, r);
        
        try
        {
          var foundItem = repo.MyApp.MyTable.FindSingle(string.Format("//[?'{0}']", tvte)); 
          wasFound = true;
          break;
        }
        catch(ElementNotFoundException) //catch here because we want to scroll to the whole table during search
        {
        }
     }
  }
  
  if(!wasFound)
  {
    //Element not found after table was scrolled completely -> now abort the test
    throw new ElementNotFoundException();
  }
}
Regards,
Philipp

Re: Why Ranorex does't support ScrollIntoView?

Posted: Fri Nov 08, 2013 7:44 am
by sincoew
Hi Philipp,

Thanks you for your reply and work around,
I known Ranorex is very powerful tool. :D

Best Regards,
Sincoew