-
Notifications
You must be signed in to change notification settings - Fork 41
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
Fix mapJSHandle
invalid memory address or nil pointer dereference
#1544
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix! I like where it is going.
Two points:
- Can we look to fix the other
evaluate
/evaluateHandle
methods onpage
andframe
? In a new PR if you prefer, but happy to have them as separate commits in this PR 🙂 - This does indeed fix the issues when
evaluate()
is used without pageFunc. It however breaks one thing which is that you can no longer pass in a string:
// As a string that is callable
console.log(await jsHandle.evaluate("node => node.innerText"));
// As a function
console.log(await jsHandle.evaluate(node => node.innerText));
- Do we need tests for at least one of these methods (maybe just on
page
?).
@ankur22, sure thing!
Sure :) Can you repurpose issue #1543? Maybe move this explanation to the issue description so that we can understand what the issue entails. Currently, it looks like it's about
Are you sure that it doesn't work with strings? I've tried this, and it worked: const n = await handle.evaluate('() => 5 * 42'); But this is a nice catch because now we don't accept non-functions 🙇 await handle.evaluate('document.title'); Update: After evaluation, I noticed that we already don't accept such a string. We only accept this form:
Would adding a test to |
eb5c1b6
to
76661a5
Compare
76661a5
to
d19534e
Compare
Sure, done.
Yeah, this script below no longer works with this branch: import { browser } from 'k6/browser';
export const options = {
scenarios: {
ui: {
executor: 'shared-iterations',
options: {
browser: {
type: 'chromium',
},
},
},
},
}
export default async function() {
const page = await browser.newPage();
try {
await page.goto('https://test.k6.io/my_messages.php');
const jsHandle = await page.waitForSelector('h2');
// As a string that is callable
console.log(await jsHandle.evaluate("node => node.innerText"));
// As a function
console.log(await jsHandle.evaluate(node => node.innerText));
} finally {
await page.close();
}
}
I think we should have table tests (integration tests) in the |
5e588a1
to
6e67b7c
Compare
6e67b7c
to
4fcb0a0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
4fcb0a0
to
b948275
Compare
What?
Add missing function arguments check to
JSHandle
mapping.Why?
#1543
Checklist
Related PR(s)/Issue(s)
Updates #1543