diff --git a/src/license-robot.js b/src/license-robot.js index c81be35..a11f1a5 100644 --- a/src/license-robot.js +++ b/src/license-robot.js @@ -51,7 +51,12 @@ async function licensePage_login(page, username, password, authenticatorKey) { page.waitForNavigation({ waitUntil: 'networkidle0' }) ]); - const verifyCodeInput = await page.$('#conversations_tfa_required_form_verify_code'); + const verifyCodeInputPromise = page.$('#conversations_tfa_required_form_verify_code'); + const licenseFileInputPromise = page.$('#licenseFile'); + + const verifyCodeInput = await verifyCodeInputPromise.catch(() => null); + const licenseFileInput = await licenseFileInputPromise.catch(() => null); + if (verifyCodeInput) { console.log("License robot. Passing two-factor authentication..."); if (!authenticatorKey) { @@ -68,6 +73,10 @@ async function licensePage_login(page, username, password, authenticatorKey) { page.waitForNavigation({ waitUntil: 'networkidle0' }) ]); } + if (licenseFileInput) { + console.log("License robot. Skip two-factor authentication"); + } + } /**