Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target closed for claimed mature/18+ game #170

Open
vogler opened this issue Jul 13, 2023 · 0 comments
Open

Target closed for claimed mature/18+ game #170

vogler opened this issue Jul 13, 2023 · 0 comments

Comments

@vogler
Copy link
Owner

vogler commented Jul 13, 2023

Extracted from #120:

  1. There was a timing issue clicking on the Continue button for the popup This game contains mature content ....
  2. Fixed by adding a delay to the click.
  3. Introduced issue of Target closed exception if a 18+ game was already claimed and context.close() was executed while the delayed click promise was still not done (unclear why this should happen since click should block).

Original comment:


Just tested Mordhau (18+):

  1. Game was claimed successfully, but got Timeout waiting for locator('text=Thank you for buying') to be visible
  2. Got Target closed exception sometimes when running afterwards.

Regarding 2., the problem is between clicking on the Continue button:

await page.click('button:has-text("Continue")', { delay: 111 });

and closing the browser context at the end:
await context.close();

When commenting either out, I did not get Target closed.
However, without the click, the message stays there and the title of the game is not detected correctly, and without the close, it just waits around at the end.
Same effect when I removed the , { delay: 111 } from the click. Adding noWaitAfter had no effect.
So it seems like Playwright creates another promise with delay which then hangs around waiting.
Catching the exception to ignore it did not work - neither adding .catch(_ => { }) for the click, nor

try {
  await context.close();
} catch (error) {
  console.error(error.message, error);
}

node --stack-trace-limit=1000 epic-games.js also only showed internal Playwright calls in the trace:

  This game contains mature content recommended only for ages 18+
  clicked continue
  waited
Current free game: MORDHAU
  Already in library! Nothing to claim.
Current free game: Second Extinction™
  Already in library! Nothing to claim.
node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

ProtocolError: Target closed
    at /fgc/node_modules/playwright-core/lib/server/firefox/ffConnection.js:189:16
    at new Promise (<anonymous>)
    at FFSession.send (/fgc/node_modules/playwright-core/lib/server/firefox/ffConnection.js:185:12)
    at RawMouseImpl.move (/fgc/node_modules/playwright-core/lib/server/firefox/ffInput.js:91:24)
    at Mouse.move (/fgc/node_modules/playwright-core/lib/server/input.js:153:23)
    at Mouse.click (/fgc/node_modules/playwright-core/lib/server/input.js:180:12)
    at /fgc/node_modules/playwright-core/lib/server/dom.js:468:109
    at /fgc/node_modules/playwright-core/lib/server/dom.js:430:13
    at FrameManager.waitForSignalsCreatedBy (/fgc/node_modules/playwright-core/lib/server/frames.js:114:26)
    at ElementHandle._performPointerAction (/fgc/node_modules/playwright-core/lib/server/dom.js:424:57)
    at async ElementHandle._retryPointerAction (/fgc/node_modules/playwright-core/lib/server/dom.js:342:22)
    at async /fgc/node_modules/playwright-core/lib/server/frames.js:992:24
    at async Frame.retryWithProgressAndTimeouts (/fgc/node_modules/playwright-core/lib/server/frames.js:914:24)
    at async /fgc/node_modules/playwright-core/lib/server/frames.js:1012:29
    at async ProgressController.run (/fgc/node_modules/playwright-core/lib/server/progress.js:92:22)
    at async FrameDispatcher.click (/fgc/node_modules/playwright-core/lib/server/dispatchers/frameDispatcher.js:149:12)
    at async DispatcherConnection.dispatch (/fgc/node_modules/playwright-core/lib/server/dispatchers/dispatcher.js:319:22) {
  sessionClosed: true
}

Node.js v19.2.0

Originally posted by @vogler in #120 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant