From 168909485104c0d370b23313d778a780500aed2b Mon Sep 17 00:00:00 2001 From: PAN Lei Date: Mon, 5 Sep 2022 00:19:54 +0200 Subject: [PATCH] first commit --- clear_data.sh | 8 ++++++++ main.js | 33 +++++++++++++++++++++++++++++++++ package.json | 8 ++++++++ yarn.lock | 15 +++++++++++++++ 4 files changed, 64 insertions(+) create mode 100644 clear_data.sh create mode 100644 main.js create mode 100644 package.json create mode 100644 yarn.lock diff --git a/clear_data.sh b/clear_data.sh new file mode 100644 index 0000000..c280170 --- /dev/null +++ b/clear_data.sh @@ -0,0 +1,8 @@ +adb shell pm clear com.android.chrome +adb shell am set-debug-app --persistent com.android.chrome +adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main +adb shell settings put global http_proxy zproxy.lum-superproxy.io:22225 +adb shell settings put global global_http_proxy_host zproxy.lum-superproxy.io +adb shell settings put global global_http_proxy_port 22225 +adb shell settings put global global_http_proxy_username um-customer-c_daabba94-zone-residential +adb shell settings put global global_http_proxy_password 9dwmh54u3bbh \ No newline at end of file diff --git a/main.js b/main.js new file mode 100644 index 0000000..5a0c9b2 --- /dev/null +++ b/main.js @@ -0,0 +1,33 @@ +const {_android: android} = require('playwright'); + +const RDV_URL = "https://rendezvousparis.hermes.com/client/register"; +// const RDV_URL = "https://bot.sannysoft.com/"; + + +(async () => { + // Connect to the device. + const [device] = await android.devices(); + console.log(`Model: ${device.model()}`); + console.log(`Serial: ${device.serial()}`); + // Take screenshot of the whole device. + await device.screenshot({path: 'device.png'}); + + { + // --------------------- Browser ----------------------- + + // Launch Chrome browser. + await device.shell('am force-stop com.android.chrome'); + const context = await device.launchBrowser({command: '--incognito'}); + + // Use BrowserContext as usual. + const page = await context.newPage(); + await page.goto(RDV_URL); + console.log(await page.evaluate(() => window.location.href)); + await page.screenshot({path: 'page.png'}); + await delay(50000); + await context.close(); + } + + // Close the device. + await device.close(); +})(); \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..7cd9d9d --- /dev/null +++ b/package.json @@ -0,0 +1,8 @@ +{ + "scripts": { + "start": "node main.js" + }, + "dependencies": { + "playwright": "1.23.0" + } +} diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..0753901 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,15 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +playwright-core@1.23.0: + version "1.23.0" + resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.23.0.tgz#51e24121b3a5bbe759d79738d8eff7a63156293c" + integrity sha512-Zzhyr5RZGoJ1ek2sgfJCt2076kdOg8hnNwFBqAYeLySiutXyxSQk93vZ5gbnFiWV1sHvueCcwla9n35acUTxtA== + +playwright@1.23.0: + version "1.23.0" + resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.23.0.tgz#93b53fa0ba194d62b8af1be7e2bceff3585fe031" + integrity sha512-rfZfuLueBPGV3UdEqPQxS8Uw7TgVMATWSPb3O0oV8SZBmVAhOndkOU9MPP8dxJoQI68r94yevuObPr14PhW9Xg== + dependencies: + playwright-core "1.23.0"