Fix 2FA problem on new login page (#305)

* fix 2FA on new login page

* change 2fa login checking element

* temporary disable parallel due to errors when script tries to dismiss buttons
This commit is contained in:
hmcdat
2025-05-30 16:43:15 +07:00
committed by GitHub
parent d5fd06d229
commit 9f5601d44b
2 changed files with 4 additions and 4 deletions

View File

@@ -2,7 +2,7 @@
"baseURL": "https://rewards.bing.com", "baseURL": "https://rewards.bing.com",
"sessionPath": "sessions", "sessionPath": "sessions",
"headless": false, "headless": false,
"parallel": true, "parallel": false,
"runOnZeroPoints": false, "runOnZeroPoints": false,
"clusters": 1, "clusters": 1,
"saveFingerprint": { "saveFingerprint": {

View File

@@ -177,7 +177,7 @@ export class Login {
private async get2FACode(page: Page): Promise<string | null> { private async get2FACode(page: Page): Promise<string | null> {
try { try {
const element = await page.waitForSelector('#displaySign', { state: 'visible', timeout: 2000 }) const element = await page.waitForSelector('#displaySign, div[data-testid="displaySign"]>span', { state: 'visible', timeout: 2000 })
return await element.textContent() return await element.textContent()
} catch { } catch {
if (this.bot.config.parallel) { if (this.bot.config.parallel) {
@@ -200,7 +200,7 @@ export class Login {
await page.click('button[aria-describedby="confirmSendTitle"]').catch(() => { }) await page.click('button[aria-describedby="confirmSendTitle"]').catch(() => { })
await this.bot.utils.wait(2000) await this.bot.utils.wait(2000)
const element = await page.waitForSelector('#displaySign', { state: 'visible', timeout: 2000 }) const element = await page.waitForSelector('#displaySign, div[data-testid="displaySign"]>span', { state: 'visible', timeout: 2000 })
return await element.textContent() return await element.textContent()
} }
} }
@@ -212,7 +212,7 @@ export class Login {
this.bot.log(this.bot.isMobile, 'LOGIN', `Press the number ${numberToPress} on your Authenticator app to approve the login`) this.bot.log(this.bot.isMobile, 'LOGIN', `Press the number ${numberToPress} on your Authenticator app to approve the login`)
this.bot.log(this.bot.isMobile, 'LOGIN', 'If you press the wrong number or the "DENY" button, try again in 60 seconds') this.bot.log(this.bot.isMobile, 'LOGIN', 'If you press the wrong number or the "DENY" button, try again in 60 seconds')
await page.waitForSelector('#i0281', { state: 'detached', timeout: 60000 }) await page.waitForSelector('form[name="f1"]', { state: 'detached', timeout: 60000 })
this.bot.log(this.bot.isMobile, 'LOGIN', 'Login successfully approved!') this.bot.log(this.bot.isMobile, 'LOGIN', 'Login successfully approved!')
break break