如何在Google Play Console批量排除非平板设备(不修改Manifest)
仅限制平板设备的高效解决方案(无需修改Manifest/重构)
批量排除所有非平板设备的自动化脚本
手动每页勾选500台设备效率极低,可通过以下脚本自动完成全页勾选、排除操作及翻页流程:
// 勾选当前页所有设备 function selectAllCurrentPage() { const selectAllCheckbox = document.querySelector('.particle-table-header mat-checkbox'); if (selectAllCheckbox && !selectAllCheckbox.classList.contains('particle-row-selected')) { selectAllCheckbox.click(); } } // 自动完成多页设备排除 async function autoExcludeAllNonTablets() { let hasNextPage = true; while (hasNextPage) { selectAllCurrentPage(); await new Promise(resolve => setTimeout(resolve, 1000)); // 等待勾选状态同步 // 执行排除操作 document.querySelector('button[aria-label="Manage devices"]')?.click(); await new Promise(resolve => setTimeout(resolve, 500)); document.querySelector('button:has(span:text("Exclude devices"))')?.click(); await new Promise(resolve => setTimeout(resolve, 1500)); // 等待排除请求完成 // 检查并切换到下一页 const nextPageBtn = document.querySelector('button[aria-label="Go to next page"]'); if (nextPageBtn && !nextPageBtn.disabled) { nextPageBtn.click(); await new Promise(resolve => setTimeout(resolve, 2000)); // 等待页面加载 } else { hasNextPage = false; console.log('所有非平板设备已排除完成'); } } } // 启动自动化流程 autoExcludeAllNonTablets();
使用步骤:
- 打开Play Console的「Device catalog」页面,设置筛选器:仅保留「Form Factor」中非平板的所有选项
- 按F12打开浏览器开发者工具,切换到Console标签
- 粘贴上述代码并回车,脚本将自动完成所有页面的设备排除操作
修复Mali GPU设备勾选无效的脚本问题
之前的脚本无法勾选是因为直接操作mat-checkbox外层组件未触发Angular内部状态变更,需直接操作底层原生复选框元素:
let checkedCounter = 0; document.querySelectorAll('.particle-table-row').forEach(row => { const rowText = row.textContent; if (rowText.includes('Mali') && !row.classList.contains('particle-row-selected')) { const checkboxInput = row.querySelector('mat-checkbox input[type="checkbox"]'); if (checkboxInput) { // 触发带冒泡的点击事件,确保Angular组件感知状态变化 checkboxInput.dispatchEvent(new Event('click', { bubbles: true })); checkedCounter++; } } }); console.log(`已勾选 ${checkedCounter} 台含Mali GPU的设备`);
内容的提问来源于stack exchange,提问作者mcExchange
相关产品推荐
相关产品推荐

