21 lines
811 B
JavaScript
21 lines
811 B
JavaScript
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 |