I would like to click an element without user input. I see it's possible in XCUIElement which is a part of the XCTest framework to ensure things are working correctly, and I'm aware of various other testing frameworks that support E2E testing with simulated clicks. But is it possible to trigger this in production outside of testing? E.g. How app remotes work for a TV - pressing a button on the app will move right, left, or click an object on the TV (only remove the TV from this question and have it target the OS it's running on)
I don't think you can access another app due to sandboxing and other security measures.
It might be easier to just call the event handler yourself, but you can trigger an event on a control.
https://stackoverflow.com/questions/4028734/how-to-programmatically-fake-a-touch-event-to-a-uibutton
That is a little old, but it should work, depending on the type of control involved. There isn't a single way to simulate events though because of differences in the controls.