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

Page.Evaluate returns undefined for a specific site #417

Closed
reginaldl opened this issue Feb 7, 2024 · 4 comments
Closed

Page.Evaluate returns undefined for a specific site #417

reginaldl opened this issue Feb 7, 2024 · 4 comments

Comments

@reginaldl
Copy link
Contributor

Hi,

I'm calling Page.Evaluate while browsing a specific site and it consistently returns nil (no error though).
Here's the debug traces:

SEND>
{"guid":"frame@77e4062f9cb0cdcd0f9aeb454d7a1983","id":45,"metadata":{"apiName":"SerializeCallStack","isInternal":false,"location":{"file":"connection.go","line":162},"wallTime":78307000},"method":"evaluateExpression","params":{"arg":{"handles":[],"value":{"n":42}},"expression":"l =\u003e String(l)"}}
RECV>
{"id":45,"guid":"","result":{"value":{"v":"undefined"}}}

Any JS would return undefined. The site is starpets.gg.
It reproduces with all browsers.
Is there any reason why evaluate would not fail but yet return undefined?
If this is a playwright bug, what's the best way to report it coming from playwright-go?

Thanks!

@canstand
Copy link
Collaborator

canstand commented Feb 8, 2024

can't reproduce via:
canstand@4b2c84c

@reginaldl
Copy link
Contributor Author

can't reproduce via: canstand@4b2c84c

Oh interesting, so it turns out that it returns nil exclusively when using playwright.WaitUntilStateNetworkidle.

Updating the following line should repro:

 _, err = page.Goto("https://starpets.gg", playwright.PageGotoOptions{WaitUntil: playwright.WaitUntilStateNetworkidle})

@canstand
Copy link
Collaborator

canstand commented Feb 9, 2024

networkidle DISCOURAGED

@reginaldl
Copy link
Contributor Author

Thanks for your detailed answer.
Networkidle is discouraged, for tests, because it relies on sleeps (500ms).
Most time based expectations are an anti-pattern in testing, hence the "DISCOURAGED".
However it doesn't explain why page.evaluate would have an unexpected behavior.
I ended up filing a bug upstream as I could repro with node: microsoft/playwright#29440

@reginaldl reginaldl closed this as not planned Won't fix, can't repro, duplicate, stale Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants