first commit

This commit is contained in:
2022-09-07 15:12:11 +02:00
parent 1689094851
commit 6266083ab8
13 changed files with 760 additions and 32 deletions
+22 -27
View File
@@ -1,33 +1,28 @@
const {_android: android} = require('playwright');
const ExcelUtil = require("./src/excel/ExcelUtil");
const CommandorPage = require("./src/workers/CommandorPage");
const RDV_URL = "https://rendezvousparis.hermes.com/client/register";
// const RDV_URL = "https://bot.sannysoft.com/";
// const RDV_URL = "http://192.168.0.44:8000/test_appointment.html"
function delay(delayInms) {
return new Promise(resolve => {
setTimeout(() => {
resolve(2);
}, delayInms);
});
}
(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();
})();
let excelUtil = new ExcelUtil();
let contactList = excelUtil.readContacts();
let commandor = new CommandorPage(contactList[2]);
// (async () => {
// Connect to the device.
const [device] = await android.devices();
console.log(`Model: ${device.model()}`);
console.log(`Serial: ${device.serial()}`);
//read contacts form excel
await commandor.loadPage();
// Take screenshot of the whole device.
// })();