We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It seems that the way k6 browser parses the functions in jshandle.evaluateHandle isn't compatible with expected javascript syntax.
jshandle.evaluateHandle
NA
When running the following test:
import { browser } from 'k6/experimental/browser'; export const options = { scenarios: { browser: { executor: 'shared-iterations', options: { browser: { type: 'chromium', }, }, }, }, }; export default async function () { const page = await browser.newPage(); try{ await page.goto('https://test.k6.io/browser.php'); const jsHandle = await page.evaluateHandle(() => ({ window, document })); const properties = await jsHandle.getProperties(); console.log(JSON.stringify(properties)); // {"window":{},"document":{}} } finally { await page.close(); } }
The result is Uncaught (in promise) evaluating handle for page: evaluating handle for frame: SyntaxError: Unexpected end of input.
Uncaught (in promise) evaluating handle for page: evaluating handle for frame: SyntaxError: Unexpected end of input
If the page.evaluateHandle is replaced with:
page.evaluateHandle
const jsHandle = await page.evaluateHandle(() => { return { window, document }; });
Then it works as expected.
Logs to console: {"document":{},"window":{}}.
{"document":{},"window":{}}
Errors with Uncaught (in promise) evaluating handle for page: evaluating handle for frame: SyntaxError: Unexpected end of input.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Brief summary
It seems that the way k6 browser parses the functions in
jshandle.evaluateHandle
isn't compatible with expected javascript syntax.xk6-browser version
NA
OS
NA
Chrome version
NA
Docker version and image (if applicable)
NA
Steps to reproduce the problem
When running the following test:
The result is
Uncaught (in promise) evaluating handle for page: evaluating handle for frame: SyntaxError: Unexpected end of input
.If the
page.evaluateHandle
is replaced with:Then it works as expected.
Expected behaviour
Logs to console:
{"document":{},"window":{}}
.Actual behaviour
Errors with
Uncaught (in promise) evaluating handle for page: evaluating handle for frame: SyntaxError: Unexpected end of input
.The text was updated successfully, but these errors were encountered: