How to simulate a mouse click in Cocoa for the iPhone?

Posted by eagle on Stack Overflow See other posts from Stack Overflow or by eagle
Published on 2010-04-24T02:59:35Z Indexed on 2010/04/24 3:03 UTC
Read the original article Hit count: 326

I'm trying to setup automated unit tests for an iPhone application. I'm using a UIWebBrowser and need to simulate clicks on different links. I've tried doing this with JavaScript, but it doesn't produce the same results as when the I manually click on the links. The main problem is with links that have their target property set.

I believe the only way for this automated unit test to work correctly is to simulate a mouse click at a specific x/y coordinate (i.e. where the link is located). Since the unit testing will only be used internally, private API calls are fine.

It seems like this should be possible since the iPhone app isimulate seems to do something similar.

Is there any way to do this in the framework?

© Stack Overflow or respective owner

Related posts about automation

Related posts about unit-testing