Created
October 27, 2013 10:09
-
-
Save bebef1987/7179941 to your computer and use it in GitHub Desktop.
Kill all method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def kill_all(self): | |
self.marionette.switch_to_frame() | |
self.marionette.execute_async_script(""" | |
// Kills all running apps, except the homescreen. | |
function killAll() { | |
let originsToClose = []; | |
let that = this; | |
let runningApps = window.wrappedJSObject.WindowManager.getRunningApps(); | |
for (let origin in runningApps) { | |
if (origin.indexOf('homescreen') == -1) { | |
window.wrappedJSObject.WindowManager.kill(origin); | |
} | |
} | |
if (!originsToClose.length) { | |
marionetteScriptFinished(true); | |
return; | |
} | |
originsToClose.slice(0).forEach(function(origin) { | |
kill(origin, function() {}); | |
}); | |
}; | |
killAll(); | |
""") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@bebef1987 can you change
WindowManager
to beAppWindowManager
?