I am automating windows UWP desktop application and wanted to kill or terminate the application after use. I am using Subprocess library in python to launch the application but could not kill it after use.
WinappdriverProcess = subprocess.Popen(['powershell.exe', 'Start-Process -FilePath "C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe" -WindowStyle Minimize'])
CRMProcess = subprocess.Popen(['powershell.exe', 'Start-Process -FilePath "C:\Testing\CRM.exe"'])
Below are the different methods I have used from web to terminate the application but none of them worked. appreciate any help.
Thank you.
1.subprocess.call(['taskkill', '/F', '/T', '/PID', str(CRMProcess.pid)])
2.os.kill(CRMProcess.pid,signal.SIGINT)
3. CRMProcess.terminate()