If you can simulate a keypress of the space bar or enter key, then that will dismiss the alert. However you'd better be doing this from outside whatever makes the alert show up in the first place, since they tend to be blocking.
If this is JavaScript, you may be better off using console.log().