Hi,
I’m trying to make some test with UIAutomation, basically, I select an image from the camera roll, UIImagePickerController allowsEditing property is set to YES. When I try to tap the “Choose” button I got this error:
Script threw an uncaught _javascript_ error: target.frontMostApp().windows()[0].buttons()[2] could not be tapped…
Looking at the view hierarchy of UIImagePickerController here’s what I got:
target.frontMostApp().windows()[0].logElementTree();
UIAWindow: rect:{{0, 0}, {320, 568}}
UIANavigationBar: name:Moments rect:{{-320, 0}, {320, 44}}
UIACollectionView: value:page 1 of 1 rect:{{-96, 0}, {320, 568}}
UIAImage: name:UINavigationVerticalColumnShadow.png rect:{{-9, 0}, {9, 568}}
UIAScrollView: rect:{{0, 0}, {320, 568}}
UIAButton: name:Cancel rect:{{13, 514}, {56, 34}}
UIAButton: rect:{{145, 515}, {30, 34}}
UIAButton: name:Choose rect:{{244, 514}, {63, 34}}
So I access the “Choose” button this way: target.frontMostApp().windows()[0].buttons()[2] and log the view hierarchy:
target.frontMostApp().windows()[0].buttons()[2].logElementTree();
UIAButton: name:Choose rect:{{244, 514}, {63, 34}}
So, definitely is not nil, but when I tap it, I got the error above.
Script threw an uncaught _javascript_ error: target.frontMostApp().windows()[0].buttons()[2] could not be tapped…
Somebody can help me?, UIAutomation is so obscure.
Thank you.
--
Juan Felipe Alvarez Saldarriaga
Twitter: @nebiros
Skype: jfasaldarriaga