Avoid crash if Cookie consent button is not visible
This commit is contained in:
parent
90af31a210
commit
b786402897
1 changed files with 4 additions and 3 deletions
|
|
@ -39,7 +39,8 @@ const page = context.pages()[0];
|
|||
console.debug('userAgent:', await page.evaluate(() => navigator.userAgent));
|
||||
|
||||
const clickIfExists = async selector => {
|
||||
if (await page.locator(selector).count() > 0)
|
||||
const cookieConsent = await page.locator(selector)
|
||||
if (await cookieConsent.count() > 0 && await cookieConsent.isVisible())
|
||||
await page.click(selector);
|
||||
};
|
||||
|
||||
|
|
@ -132,8 +133,8 @@ try {
|
|||
await page.goto(URL_CLAIM, {waitUntil: 'domcontentloaded'});
|
||||
await page.click('button[data-type="Game"]');
|
||||
} while (n);
|
||||
const p = path.resolve(dirs.screenshots, 'prime-gaming', `${datetime()}.png`);
|
||||
// await page.screenshot({ path: p, fullPage: true });
|
||||
const p = path.resolve(dirs.screenshots, 'prime-gaming', `${sanitizeFilename(datetime())}.png`);
|
||||
await page.screenshot({ path: p, fullPage: true });
|
||||
await page.locator(games_sel).screenshot({ path: p });
|
||||
} catch(error) {
|
||||
console.error(error);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue