use adb to take screenshot
This commit is contained in:
@@ -83,6 +83,10 @@ class CommandorPage {
|
||||
|
||||
async connect_to_browser(ocrResult) {
|
||||
console.log("connect_to_browser() called");
|
||||
if (this.browser === undefined) {
|
||||
this.isTerminated = true
|
||||
return
|
||||
}
|
||||
console.log("browser.isConnected: " + this.browser.isConnected());
|
||||
if (!this.browser.isConnected()) {
|
||||
this.browser = await puppeteer.connect({
|
||||
@@ -980,9 +984,10 @@ class CommandorPage {
|
||||
await this.checkResultWithOcr();
|
||||
break;
|
||||
case OCRResult.BRAVE_PRIVACY:
|
||||
if (this.device.model() === "MI 5s")
|
||||
await this.device.shell("input tap " + 530 + " " + 970)
|
||||
else if (this.device.model() === "ONEPLUS A6000")
|
||||
if (this.device.model() === "MI 5s") {
|
||||
await this.tapForDevice(this.device, 530, 970)
|
||||
// await this.device.shell("input tap " + 530 + " " + 970)
|
||||
} else if (this.device.model() === "ONEPLUS A6000")
|
||||
await this.device.shell("input tap " + 530 + " " + 1064)
|
||||
else if (this.device.model() === "KB2003")
|
||||
await this.tapForDevice(this.device, 500, 1200)
|
||||
@@ -1124,6 +1129,8 @@ class CommandorPage {
|
||||
this.device.shell("input tap " + 900 + " " + 1532)
|
||||
} else if (this.device.model() === "MI 5s") {
|
||||
this.device.shell("input tap " + 925 + " " + 1325)
|
||||
} else if (this.device.model() === "22041219PG") {
|
||||
this.device.shell("input tap " + 925 + " " + 1430)
|
||||
} else
|
||||
this.device.shell("input tap " + 933 + " " + 1538)
|
||||
await delay(2000);
|
||||
|
||||
@@ -72,9 +72,15 @@ const BRAVE_SKIP_PRIVACY_PAGE_2 = "Partagez des renseignements"
|
||||
|
||||
async function convertImageToWhiteBlack(image_path, device) {
|
||||
console.log("convertImageToWhiteBlack for " + device.serial())
|
||||
const image = await Jimp.read(image_path);
|
||||
image.grayscale().write(image_path + ".wb");
|
||||
return image_path + ".wb";
|
||||
try {
|
||||
const image = await Jimp.read(image_path);
|
||||
image.grayscale().write(image_path + ".wb");
|
||||
return image_path + ".wb";
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
return image_path
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class OCRChecker {
|
||||
|
||||
@@ -29,12 +29,11 @@ class SlidingCaptchaSolver {
|
||||
}
|
||||
|
||||
async take_screen_shot(name, device) {
|
||||
// let stdout1 = await exec("adb -s " + device.serial() + " shell screencap -p /sdcard/" + name)
|
||||
console.log("take screenshot " + name);
|
||||
await device.screenshot({path: name});
|
||||
// let stdout1 = await exec("adb -s " + device.serial() + " exec-out screencap -p > " + name)
|
||||
console.log("will take screenshot for " + device.model() + ":" + device.serial())
|
||||
let stdout1 = await exec("adb -s " + device.serial() + " exec-out screencap -p > " + name)
|
||||
// await delay(5000);
|
||||
console.log(`stdout: ${stdout1}`);
|
||||
await delay(1000);
|
||||
// console.log(`stdout: ${stdout1}`);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user