Checks for errors in the opened page every 'autoexitPolling' milliseconds, this value can be controlled by the
command line parameter --auto-exit-polling=x
function startPollingForErrors() {
    var checkFunction = (function() {
        // For an unknown reason, page.evaluate does not always load the function in the top window,
        // but can sometimes load it in an iframe inside the page...
        var topWindow = window.top;
        if (!topWindow.attester) {
            topWindow.console.log("Autoexit check error: attester does not seem to be correctly loaded!");
            topWindow.callPhantom({
                name: "attesterOnDisconnect"
            });
        } else if (!topWindow.attester.connected) {
            topWindow.console.log("Autoexit check error: attester does not seem to be connected!");
            topWindow.callPhantom({
                name: "attesterOnDisconnect"
            });
        }
    }).toString();
    setInterval(function() {
        page.evaluate(checkFunction);
    }, autoexitPolling);
}