This commit is contained in:
TheNetsky
2023-11-04 16:21:56 +01:00
parent 66dcdd4a7a
commit 3b15fe19a7
8 changed files with 26 additions and 19 deletions

View File

@@ -10,7 +10,7 @@ export class Quiz extends Workers {
try {
// Check if the quiz has been started or not
const quizNotStarted = await page.waitForSelector('#rqStartQuiz', { visible: true, timeout: 3000 }).then(() => true).catch(() => false)
const quizNotStarted = await page.waitForSelector('#rqStartQuiz', { visible: true, timeout: 2000 }).then(() => true).catch(() => false)
if (quizNotStarted) {
await page.click('#rqStartQuiz')
} else {

View File

@@ -267,14 +267,11 @@ export class Search extends Workers {
await page.click('#b_results .b_algo h2').catch(() => { }) // Since we don't really care if it did it or not
// Wait for website to load
await this.bot.utils.wait(3000)
// Will get current tab if no new one is created
let lastTab = await this.bot.browser.utils.getLatestTab(page)
// Wait for the body of the new page to be loaded
await lastTab.waitForSelector('body', { timeout: 10_000 }).catch(() => { })
// Let website load, if it doesn't load within 5 sec. exit regardless
await lastTab.waitForNetworkIdle({ timeout: 5000 }).catch(() => { })
// Check if the tab is closed or not
if (!lastTab.isClosed()) {
@@ -324,7 +321,6 @@ export class Search extends Workers {
i++
}
}
} catch (error) {
this.bot.log('SEARCH-RANDOM-CLICK', 'An error occurred:' + error, 'error')

View File

@@ -11,7 +11,7 @@ export class ThisOrThat extends Workers {
return
try {
// Check if the quiz has been started or not
const quizNotStarted = await page.waitForSelector('#rqStartQuiz', { visible: true, timeout: 3000 }).then(() => true).catch(() => false)
const quizNotStarted = await page.waitForSelector('#rqStartQuiz', { visible: true, timeout: 2000 }).then(() => true).catch(() => false)
if (quizNotStarted) {
await page.click('#rqStartQuiz')
} else {
@@ -24,7 +24,7 @@ export class ThisOrThat extends Workers {
const quizData = await this.bot.browser.func.getQuizData(page)
quizData // correctAnswer property is always null?
this.bot.log('THIS-OR-THAT', 'Completed the ThisOrthat successfully')
this.bot.log('THIS-OR-THAT', 'Completed the ThisOrThat successfully')
} catch (error) {
await page.close()
this.bot.log('THIS-OR-THAT', 'An error occurred:' + error, 'error')