Merge branch 'feature/share_cookies' of bitbucket.org:panleicim/puppeteerjs into feature/share_cookies
This commit is contained in:
@@ -19,7 +19,11 @@ class ExcelUtil {
|
||||
if (store === undefined || store.length === 0) {
|
||||
store = "random"
|
||||
}
|
||||
let newContact = new ContactPojo(phoneNumber, passportNumber, lastName, firstName, mail, store);
|
||||
let ipCountry = info[5];
|
||||
if (ipCountry === undefined || ipCountry.length === 0) {
|
||||
ipCountry = "FR"
|
||||
}
|
||||
let newContact = new ContactPojo(phoneNumber, passportNumber, lastName, firstName, mail, store, ipCountry);
|
||||
contactList.push(newContact);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
class ContactPojo {
|
||||
|
||||
constructor(phoneNumber, passportNumber, lastName, firstName, mail, store) {
|
||||
constructor(phoneNumber, passportNumber, lastName, firstName, mail, store, ipCountry) {
|
||||
this.phoneNumber = phoneNumber;
|
||||
this.passportNumber = passportNumber;
|
||||
this.lastName = lastName;
|
||||
this.firstName = firstName;
|
||||
this.mail = mail;
|
||||
this.store = store;
|
||||
this.ipCountry = ipCountry;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
module.exports = ContactPojo
|
||||
+5
-4
@@ -1,7 +1,8 @@
|
||||
const amqp = require("amqplib");
|
||||
|
||||
const QUEUE_HOST = "amqp://appointment:ZyuhJZ2xEYWhElhpJjy7YEpZGZwNYJz2fHIu@appointment.lpaconsulting.fr:5672"
|
||||
const REQUEST_DATA_QUEUE = 'REQUEST_DATA';
|
||||
const REQUEST_DATA_QUEUE_FR = 'REQUEST_DATA';
|
||||
const REQUEST_DATA_QUEUE_DE = 'REQUEST_DATA_DE';
|
||||
|
||||
class Sender {
|
||||
channel;
|
||||
@@ -10,11 +11,11 @@ class Sender {
|
||||
async initConnection() {
|
||||
this.connection = await amqp.connect(QUEUE_HOST);
|
||||
this.channel = await this.connection.createChannel();
|
||||
await this.channel.assertQueue(REQUEST_DATA_QUEUE, {persistent: true});
|
||||
await this.channel.assertQueue(REQUEST_DATA_QUEUE_FR, {persistent: true});
|
||||
}
|
||||
|
||||
sendMessage(msg) {
|
||||
this.channel.sendToQueue(REQUEST_DATA_QUEUE, Buffer.from(msg))
|
||||
sendMessage(msg, queue_name = REQUEST_DATA_QUEUE_FR) {
|
||||
this.channel.sendToQueue(queue_name, Buffer.from(msg))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -891,6 +891,10 @@ class CommandorPage {
|
||||
cookiesString = cookiesString + cookie.name + "=" + cookie.value + ";"
|
||||
})
|
||||
console.log(cookiesString);
|
||||
|
||||
if (this.contact.ipCountry === "DE")
|
||||
this.sender.sendMessage(cookiesString, "REQUEST_DATA_DE")
|
||||
else
|
||||
this.sender.sendMessage(cookiesString)
|
||||
// let content = await this.page.content()
|
||||
// console.log(content)
|
||||
@@ -1228,21 +1232,21 @@ class CommandorPage {
|
||||
|
||||
async enableDisableAirPlanMode() {
|
||||
logWithDevice("will enable/disable airplane mode", this.device)
|
||||
try {
|
||||
// await this.device.shell("cmd connectivity airplane-mode enable")
|
||||
await exceutShellCmd(this.device, "cmd connectivity airplane-mode enable")
|
||||
await delay(1000)
|
||||
await exceutShellCmd(this.device, "cmd connectivity airplane-mode disable")
|
||||
// try {
|
||||
// // await this.device.shell("cmd connectivity airplane-mode enable")
|
||||
// await exceutShellCmd(this.device, "cmd connectivity airplane-mode enable")
|
||||
// await delay(1000)
|
||||
// await exceutShellCmd(this.device, "cmd connectivity airplane-mode disable")
|
||||
// // await this.device.shell("cmd connectivity airplane-mode disable")
|
||||
// await delay(2000)
|
||||
// } catch (e) {
|
||||
// try {
|
||||
// await this.device.shell("cmd connectivity airplane-mode disable")
|
||||
await delay(2000)
|
||||
} catch (e) {
|
||||
try {
|
||||
await this.device.shell("cmd connectivity airplane-mode disable")
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
console.log(e)
|
||||
}
|
||||
// } catch (e) {
|
||||
// console.log(e)
|
||||
// }
|
||||
// console.log(e)
|
||||
// }
|
||||
}
|
||||
|
||||
async tapGoogleDisconnectBtn() {
|
||||
|
||||
Reference in New Issue
Block a user