Sometimes, UIAElement.tap() fails with "scrollToVisible..."

Originator:heath.borders
Number:rdar://10987022 Date Originated:05-Mar-2012 03:33 PM
Status:Open Resolved:
Product:iPad SDK Product Version:4.2.1/Build 4D502
Classification:Serious Bug Reproducible:Sometimes
 
05-Mar-2012 03:33 PM Heath Borders:
Summary:
Sometimes, UIAElement.tap() fails with "scrollToVisible could not generate a scroll to make the element visible."

After the failure, I call window.logElementTree(), and the UIAElement I'm trying to tap is present.

Steps to Reproduce:
Create a GUI with a horizontal scroll view.
Within the scroll view add enough children to require horizontal scrolling.
Call UIAElement.tap() on an element that is not visible on the screen

Expected Results:
The UIAElement should be scrolled to visibility before being tapped.

Actual Results:
The following errors are reported
2012-03-05 21:25:08 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()["Scroll View"].staticTexts()["Child"].tap()
2012-03-05 21:25:08 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()["Scroll View"].staticTexts()["Child"].scrollToVisible()
2012-03-05 21:25:09 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()["Scroll View"].staticTexts()["Child"] - scrollToVisible could not generate a scroll to make the element visible.
2012-03-05 21:25:09 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()["Scroll View"].staticTexts()["Child"] - scrollToVisible could not generate a scroll to make the element visible.
2012-03-05 21:25:09 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()["Scroll View"].staticTexts()["Child"] could not be tapped

Regression:

Notes:

Comments

I'm constantly facing this issue in the app I test. Some of the objects (even buttons) can't be tapped (don't know the reason), however, they provide a rect() property which I use in a following workaround:

function tapByRect(rect){

var XtoTap = Math.round(rect.origin.x + (rect.size.width / 2));
var YtoTap = Math.round(rect.origin.y + (rect.size.height / 2));
var target = UIATarget.localTarget();
target.tapWithOptions({x:XtoTap, y:YtoTap});

}

you just need to pass a rect property value of the object to tap - it works for me.

Sergey


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!