Better handling and logging
This commit is contained in:
@@ -86,7 +86,8 @@ async function createAccount(driver) {
|
||||
await VerificationCodeInput.sendKeys(`${code}`);
|
||||
}
|
||||
catch (err) {
|
||||
return;
|
||||
await driver.quit();
|
||||
return 1;
|
||||
}
|
||||
await driver.findElement(By.id('iOptinEmail')).click();
|
||||
await driver.sleep(clickTime);
|
||||
@@ -96,24 +97,16 @@ async function createAccount(driver) {
|
||||
const source = await driver.getPageSource();
|
||||
if (source.includes('Phone number')) {
|
||||
console.log('Ip usage exceeded please switch IP');
|
||||
// await disconnect();
|
||||
await driver.quit();
|
||||
const answer = await questionAsync('Would you like to continue? [y/n] ');
|
||||
if (answer.toLowerCase() === 'n' || answer.toLowerCase() === 'no') {
|
||||
console.log('Program stopped.');
|
||||
await driver.quit();
|
||||
process.exit(0);
|
||||
}
|
||||
else {
|
||||
console.log('Continuing...');
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
// try {
|
||||
// await connect();
|
||||
// }
|
||||
// catch (error) {
|
||||
// console.error('Error connecting to mail server:', error);
|
||||
// await driver.quit();
|
||||
// process.exit(0);
|
||||
// }
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -198,12 +191,14 @@ async function createAccount(driver) {
|
||||
await driver.findElement(By.xpath('//span[contains(text(), "SET AS GOAL")]')).click();
|
||||
|
||||
await driver.sleep(2000);
|
||||
await driver.quit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
await driver.quit();
|
||||
catch (err) {
|
||||
return 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
module.exports = { createAccount };
|
||||
Reference in New Issue
Block a user