check 'signed in' in loop

This commit is contained in:
Ralf Vogler 2022-01-02 19:52:03 +01:00
parent 0e19708503
commit e2c2f97114

View file

@ -71,7 +71,7 @@ const newStealthContext = async (browser, contextOptions = {}) => {
await page.goto(URL_CLAIM, {waitUntil: 'domcontentloaded'}); // default 'load' takes forever await page.goto(URL_CLAIM, {waitUntil: 'domcontentloaded'}); // default 'load' takes forever
// with persistent context the cookie message will only show up the first time, so we can't unconditionally wait for it - just let the user click it. // with persistent context the cookie message will only show up the first time, so we can't unconditionally wait for it - just let the user click it.
// await page.click('button:has-text("Accept All Cookies")'); // to not waste screen space in --debug // await page.click('button:has-text("Accept All Cookies")'); // to not waste screen space in --debug
if (await page.locator('a[role="button"]:has-text("Sign In")').count() > 0) { while (await page.locator('a[role="button"]:has-text("Sign In")').count() > 0) {
console.error("Not signed in anymore. Please login and then navigate to the 'Free Games' page."); console.error("Not signed in anymore. Please login and then navigate to the 'Free Games' page.");
context.setDefaultTimeout(0); // give user time to log in without timeout context.setDefaultTimeout(0); // give user time to log in without timeout
await page.goto(URL_LOGIN, {waitUntil: 'domcontentloaded'}); await page.goto(URL_LOGIN, {waitUntil: 'domcontentloaded'});