Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

scrollToVisible error while testing on a device, UIAutomation

For this line of test code : view.scrollViews()[0].tapWithOptions({tapOffset:{x:0.32, y:0.25}})

I am getting this error

2012-11-02 18:09:23 +0000 None: Script threw an uncaught JavaScript error: target.frontMostApp().mainWindow().scrollViews()[0] could not be tapped on line 244 of feature.js
2012-11-02 18:09:23 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()[0].tapWithOptions({tapOffset:{x:"0.32", y:"0.25"}})
2012-11-02 18:09:23 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()[0].scrollToVisible()
2012-11-02 18:09:23 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()[0] - scrollToVisible cannot be used on the element because it does not have a scrollable ancestor.
2012-11-02 18:09:23 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()[0] - scrollToVisible cannot be used on the element because it does not have a scrollable ancestor.
2012-11-02 18:09:23 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()[0] could not be tapped

The logelement tree looks like this

UIATarget "MyiPadname" {{0, 0}, {1024, 768}}
elements: {
UIAApplication "myAppName" {{0, 0}, {1024, 768}}
elements: {
    UIAWindow "(null)" {{0, 0}, {1024, 768}}
    elements: {
        UIAScrollView "(null)" {{0, 0}, {1024, 768}}
        elements: {
            UIAImage "(null)" {{1017, 761}, {7, 7}}
            UIAImage "(null)" {{1017, 761}, {7, 7}}
        }
        UIAImage "nav_bar.png" {{0, 724}, {1024, 44}}
        UIAButton "button featured" {{0, 730}, {134, 39}}
        UIAButton "See the world" {{134, 730}, {223, 39}}
        UIAButton "button my favorites" {{357, 730}, {180, 39}}
        UIAButton "button settings" {{967, 736}, {33, 27}}
    }
 }
}

I am using XCode 4.5.1 . Can anyone help me to fix this . Thanks

like image 921
codemau5 Avatar asked Apr 06 '26 05:04

codemau5


1 Answers

Are you, by any chance, using iOS 5.x simulator or iOS 5.x device? If yes then I am seeing the same issue. I believe Xcode 4.5.1 does not like ScrollViews.

But, I found a workaround.

My element is looks like :

target.frontMostApp().mainWindow().scrollViews()[0].buttons()["Wikipedia"]

So, instead of accessing the button directly, I am trying to access a staticText for the button.

target.frontMostApp().mainWindow().scrollViews()[0].buttons()["Wikipedia"].staticTexts()["Wikipedia"].tap();

I hope this works for you.

like image 129
Rahul Jawale Avatar answered May 07 '26 10:05

Rahul Jawale