jeudi 29 septembre 2016

NoSuchWindowException when trying to get a report inside a new window

I have the following in my code:

withWindow({ title == 'Google' }) {
    report "08"
}

And report is leading me to the exception NoSuchWindowException. I've checked if that was a problem of the Window selector and it isn't,After some research I guessed that the problem was that the driver got messed in the way so I stored and switched my driver:

String  mainHandle= driver.getWindowHandle();
driver.switchTo().window('Google');

But I kept getting the same error. So I tried:

driver.get("http://www.google.com");

And it is working but I need to do this dinamycally and automatically because the windows and popups that we are working with are hundreds and with different titles.

How can I achieve that in every windows that opens? We are generating the code with a external tool so I don't need to do "magic", only a driver.get.windowUrl or something like this will work for me.

Aucun commentaire:

Enregistrer un commentaire