swipeForDevice instead of device.shell()

This commit is contained in:
Lei PAN
2024-03-02 09:41:32 +01:00
parent 422b004561
commit 2dd43cf208
+11 -3
View File
@@ -167,9 +167,10 @@ class CommandorPage {
for (let i = 1; i <= limit; i++) {
let x = 350 + getRandom() * 100
let y0 = 600 + getRandom() * 100 + getRandom() * 10 + getRandom() * 1
let swipCmd = "input swipe " + x + " " + y0 + " " + x + " 1522"
logWithDevice("will send cmd:" + swipCmd, this.device)
await this.device.shell(swipCmd);
// let swipCmd = "input swipe " + x + " " + y0 + " " + x + " 1522"
// logWithDevice("will send cmd:" + swipCmd, this.device)
await this.swipeForDevice(this.device, x, y0, x, 1522)
// await this.device.shell(swipCmd);
await delay(3 * getRandomWaitTime());
}
// await this.openGoogle()
@@ -1200,6 +1201,13 @@ class CommandorPage {
await exec(cmd);
}
async swipeForDevice(device, x0, y0, x1, y1) {
// let swipCmd = "input swipe " + x + " " + y0 + " " + x + " 1522"
let cmd = `adb -s ${device.serial()} shell input swipe ${x0} ${y0} ${x1} ${y1}`
logWithDevice("cmd is " + cmd, this.device)
await exec(cmd);
}
async inputForDevice(device, text) {
let cmd = `adb -s ${device.serial()} shell input text ${text}`
logWithDevice("cmd is " + cmd, this.device)