Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Attempts to tap a UIButton in a UITableViewCell using UI Automation fail with "could not be tapped"

I have an iPhone app that I'm testing using UI Automation.

I have a button in a UITableViewCell but when I try to tap on it using UI Automation I get the following error.

Script threw an uncaught JavaScript error: target.frontMostApp().mainWindow().scrollViews()[0].elements()[element_name].tableViews()[0].elements().firstWithPredicate(name contains[c] 'Brooklyn').elements()["detailsButton"] could not be tapped

I have enabled accessibility on the button in Interface Builder and assigned the accessibility label (and identifier) "detailsButton". I can retrieve the button element and have verified that it is valid. I just can't tap it for some reason.

UIATableCell Brooklyn

The UIButton is a round rectangular button with user interaction enabled. Thanks for any feedback.

like image 621
kodie Avatar asked Jan 18 '12 22:01

kodie


2 Answers

You can alloc the UIButton except using round rect button. And also you can set target action of button in your controller class where table view delegate methods are presents.

like image 84
Wish Avatar answered Nov 07 '22 21:11

Wish


Try asserting first if the button exists, use tuneup_js for easy assertions. Then assert if the button is enabled.

Have you tried: target.frontMostApp().mainWindow().scrollViews()[0].elements()[element_name].tableViews()[0].**cells()**.firstWithPredicate("name contains[c] 'Brooklyn'").elements()["detailsButton"]?

Also post another picture which shows the UIATableCell expanded where the detailsButton exists.

like image 32
stackErr Avatar answered Nov 07 '22 22:11

stackErr