If you're going to try to simulate user actions, make sure the user can do them
Many people like to simulate user actions programmatically. I'm not going to comment here on whether that's a good idea to begin with; what I want to point out is that if you're going to do it, you have to make sure you're simulating things the user can actually do. For example, if you want to act as if the user clicked the "close" button in the ...