Winium.Desktop icon indicating copy to clipboard operation
Winium.Desktop copied to clipboard

maximize window and close application are not working for one click app(appref-ms). Please help me with any work around

Open vrupanixp opened this issue 7 years ago • 1 comments

  1. Maximize window is not working on one click app(appref-ms), used path as "C://Users//abc///QA.appref-ms" used below, driver.manage().window().maximize();

  2. driver.close(); or driver.quit(); also not working to close the opened application.

Please suggest to make them work

vrupanixp avatar Nov 16 '17 14:11 vrupanixp

I don't have an answer for issue 1.

For issue 2. I also had this problem, I couldn't find a solution for driver.close(); or driver.quit(); to actually exit the application. For that I created a separate close function using Robot key events, like VK_ALT + VK_F4. This would look something like the following:

try{ Robot robot = new Robot(); robot.keyPress(KeyEvent.VK_ALT); robot.keyPress(KeyEvent.VK_F4); robot.keyRelease(KeyEvent.VK_ALT); robot.keyRelease(KeyEvent.VK_F4); } catch(Exception e){}

Additionally, with one of the quirks of Winium being that your machine will continue to listen on port 9999 (causing a failure of further driver instantiations), you want to make sure that you execute service.stop(); to actually stop listening on that port and shutdown the driver service. You can use the robot functions to close the application itself and then use service.stop(); to make sure you can rerun your test without having to use netstat or something manually through the command line to free up 9999.

Hope this helps.

bkraky avatar Mar 19 '19 16:03 bkraky