From ba97a0e840b65f4476cca18e28d8461b0c703420 Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Tue, 28 Dec 2021 00:28:48 +0100 Subject: [PATCH] old playwright-extra has no :has-text?, now fails at page.frameLocator --- main.captcha.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.captcha.js b/main.captcha.js index 29562e05..a698df8c 100644 --- a/main.captcha.js +++ b/main.captcha.js @@ -30,18 +30,18 @@ chromium.use(RecaptchaPlugin(RecaptchaOptions)); const page = await context.newPage(); await page.goto('https://www.epicgames.com/store/en-US/free-games'); // await expect(page.locator('a[role="button"]:has-text("Sign In")')).toHaveCount(0); - await page.click('button:has-text("Accept All Cookies")'); // to not waste screen space in --debug + await page.click('#onetrust-accept-btn-handler'); // accept cookies to not waste screen space await page.click('[data-testid="offer-card-image-landscape"]'); // TODO check if already claimed await page.click('[data-testid="purchase-cta-button"]'); - await page.click('button:has-text("Continue")'); + await page.click('div[data-component=makePlatformUnsupportedWarningStep] > button'); // it then creates an iframe for the rest // await page.frame({ url: /.*store\/purchase.*/ }).click('button:has-text("Place Order")'); // not found because it does not wait for iframe const iframe = page.frameLocator('.webPurchaseContainer iframe') await iframe.locator('button:has-text("Place Order")').click(); await iframe.locator('button:has-text("I Agree")').click(); - // await page.pause(); await page.solveRecaptchas(); + await page.pause(); await context.close(); await browser.close(); })();