-
-
Save zacc/8450360 to your computer and use it in GitHub Desktop.
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.AppWindowManager.getRunningApps(); | |
for (let origin in runningApps) { | |
if (origin.indexOf('homescreen') == -1) { | |
window.wrappedJSObject.AppWindowManager.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