mirror of
https://github.com/TheNetsky/Microsoft-Rewards-Script.git
synced 2026-01-11 10:56:17 +00:00
1.3.1
- Poll clicking will be attempted regardless of the selector being found - Fix tabs sticking upon search error - Updated dependencies
This commit is contained in:
@@ -11,7 +11,7 @@ export class Poll extends Workers {
|
||||
try {
|
||||
const buttonId = `#btoption${Math.floor(this.bot.utils.randomNumber(0, 1))}`
|
||||
|
||||
await page.waitForSelector(buttonId, { visible: true, timeout: 10_000 })
|
||||
await page.waitForSelector(buttonId, { visible: true, timeout: 10_000 }).catch(() => { }) // We're gonna click regardless or not
|
||||
await this.bot.utils.wait(2000)
|
||||
|
||||
await page.click(buttonId)
|
||||
|
||||
@@ -154,6 +154,22 @@ export class Search extends Workers {
|
||||
this.bot.log('SEARCH-BING', 'Search failed, An error occurred:' + error, 'error')
|
||||
this.bot.log('SEARCH-BING', `Retrying search, attempt ${i}/5`, 'warn')
|
||||
|
||||
// Reset the tabs
|
||||
const browser = searchPage.browser()
|
||||
const tabs = await browser.pages()
|
||||
const lastTab = await this.bot.browser.utils.getLatestTab(searchPage)
|
||||
|
||||
if (tabs.length === 4) {
|
||||
await lastTab.close()
|
||||
|
||||
} else if (tabs.length === 2) {
|
||||
const newPage = await browser.newPage()
|
||||
await newPage.goto(this.searchPageURL)
|
||||
|
||||
} else {
|
||||
await lastTab.goBack()
|
||||
}
|
||||
|
||||
await this.bot.utils.wait(4000)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user