Opera Windows do not close om #quit():
On my Windows 8 PC everything works fine, in Server 2008 RS nothing works correclty. Using this code to restart the Driver:
public static void init(){
System.setProperty("webdriver.opera.driver", "C:\\Users\\" + System.getProperty("user.name") + "\\Desktop\\driver\\od.exe");
if(driver != null){
driver.quit();
}
System.out.println("Starting driver...");
driver = new OperaDriver();
System.out.println("Started driver.");
}
The session starts again, but the problem is the other windows aren't closing and consuming a lot of RAM after some time.
Temporary fix:
Robot robot = new Robot(); robot.keyPress(KeyEvent.VK_ALT); robot.keyPress(KeyEvent.VK_F4);
Reproduced, in my case for Windows10 version 47.0.2631.55 (PGO), also reproduced on ElCapitan instance.
As a non-robot workaround solution for java, you can kill process by invocation of command line commands as separate process (I guess that more stable, than Robot).
For windows:
Runtime.getRuntime().exec("taskkill /f /im opera.exe");
For Macos:
Runtime.getRuntime().exec("pgrep 'Opera' | xargs kill");
+1 for fix, because it's really annoying when tens of opera windows stay open. In my case, each test runs in a new independent session. My tests are developed on pure selenium and I'm using Opera as my default browser so any workaround doesn't fit to me. Thanks.
I can confirm, that this issue still exists. I was able to reproduce it with operadriver 2.32 and Opera 52. Currently the only work around is to start Opera by proving a path to 'Opera.exe' instead of 'Launcher.exe'. This way everything works fine. Is this your case? @simpleC0de @qwikso @BobFrostMan
Okay, how could be with Remote web driver?
For windows:
Runtime.getRuntime().exec("taskkill /f /im opera.exe");
For Macos:
Runtime.getRuntime().exec("pgrep 'Opera' | xargs kill");
does not work on remote workers.
I believe this is a active issue, I've experienced this issue with Firefox and Chrome, but when testing on Linux the processes close correctly. A workaround would be to kill all child processes associated with the WebDriver or your own process, but it's not ideal. Any ideas why this issue is happening on Windows?