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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[expect-puppeteer] Puppeteer v17 incompatibility #494

Closed
swissspidy opened this issue Aug 31, 2022 · 2 comments
Closed

[expect-puppeteer] Puppeteer v17 incompatibility #494

swissspidy opened this issue Aug 31, 2022 · 2 comments

Comments

@swissspidy
Copy link
Contributor

swissspidy commented Aug 31, 2022

馃悰 Bug Report

expect-puppeteer uses ElementHandle.executionContext() to get the page object from a given ElementHandle:

https://github.com/smooth-code/jest-puppeteer/blob/a7b569351fc6be97f6e24b6f2967d47ddd6f4329/packages/expect-puppeteer/src/utils.js#L24-L30

In puppeteer/puppeteer#8844, which was released as part of Puppeteer v17, the execution context has been marked internal, so this access is no longer possible.

To Reproduce

If you do something like this, this will break with Puppeteer v17:

const elementHandle = await expect(page).toMatchElement('button');
expect(elementHandle).toClick();

Getting errors like this:

TypeError: executionContext.frame is not a function

Expected behavior

There needs to be either a workaround to ensure compatibility or a new major release removing support for this usage if this is no longer possible.

Link to repl or repo (highly encouraged)

Please provide a minimal repository on GitHub.

Issues without a reproduction link are likely to stall.

Run npx envinfo --system --binaries --npmPackages expect-puppeteer,jest-dev-server,jest-environment-puppeteer,jest-puppeteer,spawnd --markdown --clipboard

Paste the results here:

## System:
 - OS: macOS 12.5.1
 - CPU: (10) arm64 Apple M1 Pro
 - Memory: 329.19 MB / 32.00 GB
 - Shell: 3.2.57 - /bin/bash
## Binaries:
 - Node: 16.17.0 - ~/.nvm/versions/node/v16.17.0/bin/node
 - npm: 8.15.0 - ~/.nvm/versions/node/v16.17.0/bin/npm
@swissspidy
Copy link
Contributor Author

The new recommended approach in v17.1.0 is to use ElementHandle.frame() directly, see puppeteer/puppeteer#8875. It should be released soon.

@gregberge
Copy link
Member

The last version (v7) is compatible to Puppeteer v19.

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

No branches or pull requests

3 participants