Question

I have to test a web-application with Selenium (actually I'm using it in Java).

there is an confirmation Dialog on leaving the page and I need to handle it in Selenium, the 1. confirmation box i can handle easily, but Firefox throws out and 2 confirmation box with standard message and I don't know how to turn it of or handle it with Selenium.

window.onbeforeunload = onEditorClose;
          function onEditorClose() {
                msg = "Möchten Sie den Editor schließen?";
                return confirm(msg);
            }

I have some possible Solutions like, deleting the 1. confirmation and only having the standard message but even there is the problem, Selenium seems not to be able to handle the standard dialog :O.

Can anyone help me here?

Was it helpful?

Solution

I easily solved the Problem, I just overwritten the function with selenium.runScript();

selenium.runScript("window.onbeforeunload = null;");  

so when before the window gets closed the onbeforeunload is seted to null and nothing will happen, while closing :P.

for me its OK, cause i don't need to test the onbeforeload.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top