Problem: The GhostDriver API does not yet support alert handling. There is an acceptable workaround for the time being, which is to inject your own javascr
A simple solution is to rewrite the window.alert method to output the argument to a global variable.
Define the js injection variable with your override function:
js = """
window.alert = function(message) {
lastAlert = message;
}
"""
And then just pass the js variable through the execute_script call in python like this:
driver.execute_script("%s" % js)
Then when it's all been run you can execute a return on the global lastAlert:
driver.execute_script("return lastAlert")