try to handle error

This commit is contained in:
2022-09-09 10:30:42 +02:00
parent 3557a2ed90
commit 374a8d22f2
5 changed files with 73 additions and 9 deletions
+21
View File
@@ -0,0 +1,21 @@
const {_android: android} = require('playwright');
const CLEARDATACOMMAND = "pm clear com.android.chrome"
const SET_DEBUGABLE = "am set-debug-app --persistent com.android.chrome"
const START_CHROME = "am start -n com.android.chrome/com.google.android.apps.chrome.Main"
android.devices().then(deviceList => {
deviceList.forEach(async (device) => {
console.log(`Model: ${device.model()}`);
console.log(`Serial: ${device.serial()}`);
await clearChromeDataForDevice(device)
})
})
async function clearChromeDataForDevice(device) {
console.log(`Model: ${device.model()}`);
console.log(`Serial: ${device.serial()}`);
await device.shell(CLEARDATACOMMAND)
await device.shell(SET_DEBUGABLE)
await device.shell(START_CHROME)
}
module.exports = clearChromeDataForDevice