I am building a UI testing framework which uses a headless browser (phantomJS in my case) to interact with html documents - without using jQuery I need to display a prompt (which is fine) and then programmatically enter text into the prompt dialog and then click OK, all with pure javascript. This will then add some text to a div so that I can verify the result.
Everything I have read online seems to suggest that this is not possible as the prompt/dialog boxes are built-in to the browser itself and not part of the DOM. I cannot see any properties/methods on the DOM to get the dialog and document.activeElement is returning me back the page, not the prompt. So I'm stumped.
How do I do this?