How to perform Eval on an async function (like a fetch operation) #1178
Unanswered
cardilloscreations
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In my use case, I cannot use the built in hijacking because the web page hooks the fetch function and it will be easier to just do a fetch and get the JSON I need from their related API (needs a session to be established first). So I need to perform an Eval with an async fetch operation. When I run a command in the console (even a non-headless browser launched by go-rod in the same way - for testing purposes) it works fine. But when I try various combinations of Eval with AwaitPromise true, it does not work. It's like the async wait just times out.
I've tried this for example:
If I strip that down without the function in console it works fine. Also, if I run it as an IIFE, it works fine in console and the promise returns with the response, for example:
Tracing through go-rod a little, I see this is done with an
apply
statement so I'm wondering if that's the source of the problem? Any idea what I'm missing here?Beta Was this translation helpful? Give feedback.
All reactions