mirror of
https://github.com/TheNetsky/Microsoft-Rewards-Script.git
synced 2026-01-18 05:53:57 +00:00
1.5.2
- Updated packages - Cleanup - Improved message dismissal - Improved login functionality With help from @LightZirconite
This commit is contained in:
@@ -46,7 +46,7 @@ class Browser {
|
||||
const context = await newInjectedContext(browser as any, { fingerprint: fingerprint })
|
||||
|
||||
// Set timeout to preferred amount
|
||||
context.setDefaultTimeout(this.bot.utils.stringToMs(this.bot.config?.globalTimeout ?? 30_000))
|
||||
context.setDefaultTimeout(this.bot.utils.stringToMs(this.bot.config?.globalTimeout ?? 30000))
|
||||
|
||||
await context.addCookies(sessionData.cookies)
|
||||
|
||||
|
||||
@@ -298,7 +298,7 @@ export default class BrowserFunc {
|
||||
|
||||
async waitForQuizRefresh(page: Page): Promise<boolean> {
|
||||
try {
|
||||
await page.waitForSelector('span.rqMCredits', { state: 'visible', timeout: 10_000 })
|
||||
await page.waitForSelector('span.rqMCredits', { state: 'visible', timeout: 10000 })
|
||||
await this.bot.utils.wait(2000)
|
||||
|
||||
return true
|
||||
|
||||
@@ -13,6 +13,7 @@ export default class BrowserUtil {
|
||||
|
||||
async tryDismissAllMessages(page: Page): Promise<boolean> {
|
||||
const buttons = [
|
||||
{ selector: 'button[type="submit"]', label: 'Submit Button' },
|
||||
{ selector: '#acceptButton', label: 'AcceptButton' },
|
||||
{ selector: '.ext-secondary.ext-button', label: '"Skip for now" Button' },
|
||||
{ selector: '#iLandingViewAction', label: 'iLandingViewAction' },
|
||||
@@ -23,21 +24,25 @@ export default class BrowserUtil {
|
||||
{ selector: '.ms-Button.ms-Button--primary', label: 'Primary Button' },
|
||||
{ selector: '.c-glyph.glyph-cancel', label: 'Mobile Welcome Button' },
|
||||
{ selector: '.maybe-later', label: 'Mobile Rewards App Banner' },
|
||||
{ selector: '//div[@id="cookieConsentContainer"]//button[contains(text(), "Accept")]', label: 'Accept Cookie Consent Container' },
|
||||
{ selector: '//div[@id="cookieConsentContainer"]//button[contains(text(), "Accept")]', label: 'Accept Cookie Consent Container', isXPath: true },
|
||||
{ selector: '#bnp_btn_accept', label: 'Bing Cookie Banner' },
|
||||
{ selector: '#reward_pivot_earn', label: 'Reward Coupon Accept' }
|
||||
]
|
||||
|
||||
const dismissTasks = buttons.map(async (button) => {
|
||||
try {
|
||||
const element = page.locator(button.selector)
|
||||
const element = button.isXPath
|
||||
? page.locator(`xpath=${button.selector}`)
|
||||
: page.locator(button.selector)
|
||||
|
||||
if (await element.first().isVisible({ timeout: 1000 })) {
|
||||
await element.first().click({ timeout: 1000 })
|
||||
await page.waitForTimeout(500)
|
||||
this.bot.log(this.bot.isMobile, 'DISMISS-ALL-MESSAGES', `Dismissed: ${button.label}`)
|
||||
return true
|
||||
}
|
||||
} catch (error) {
|
||||
// Ignore errors and continue
|
||||
} catch {
|
||||
// Silent fail
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user