We have a JavaScript file that our customers are installing on their site to capture certain behaviors and emit events when certain actions are taken. We'd like to have a utility on our backend to periodically load the page and trigger a test run of the script to make sure it's still able to emit the events we need.
Our back-end is written in Java, and ideally I'd like a solution that can be done entirely from within Java. What I'm looking for is a headless browser that can load a page, add a listener for the event our script emits, trigger a test of the event, verify the result against an expected value, and then report back to our application if everything's still behaving as expected.
Right now the closest I've come to this is running a PhantomJS file, writing the output to standard output, then calling that from Java and reading the standard output buffer. That's a doable fallback, but I'd prefer something that can be entirely run in Java.
I've looked at Selenium briefly, and am going back to take a closer look, but my first impression was that it would be overkill for what I'm trying to do. Are there any better options out there?