I want to write an application in Java, which should test a website in a headless browser, like for example PhantomJS or zombie.js. PhantomJS scripts are written in JavaScript so how can I use the JavaScript API provided by PhantomJS in my Java application without using Selenium with GhostDriver? Has this something to do with the library Nashorn?
More details with the steps I need to go through:
1. Create a HTTP-Request (for example with: java.net.HttpUrlConnection.) and send it to a Web Server
2. Get the corresponding Response and save the Source in a HTML File
3. Open the HTML File in a FAST headless browser (no HtmlUnit)
4. Verify if an Alert with message xxx appears or not when opening the HTML Response
Does anybody know a solution?
PS: It would be easy if PhantomJs with GhostDriver would support alert handling, but it does not!