This commit is contained in:
TheNetsky
2023-09-25 12:16:40 +02:00
parent 0a675dd6e0
commit c802492f18
27 changed files with 2115 additions and 1 deletions

View File

@@ -0,0 +1,26 @@
import { Page } from 'puppeteer'
import { getLatestTab } from '../../BrowserUtil'
import { log } from '../../util/Logger'
import { PromotionalItem, MorePromotion } from '../../interface/DashboardData'
export async function doUrlReward(page: Page, data: PromotionalItem | MorePromotion) {
log('URL-REWARD', 'Trying to complete UrlReward')
try {
const selector = `[data-bi-id="${data.offerId}"]`
// Wait for page to load and click to load the url reward in a new tab
await page.waitForSelector(selector, { timeout: 5000 })
await page.click(selector)
// After waiting, close the page
const visitPage = await getLatestTab(page)
await visitPage.close()
log('URL-REWARD', 'Completed the UrlReward successfully')
} catch (error) {
log('URL-REWARD', 'An error occurred:' + error, 'error')
}
}