-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Question] How can I repeat a request? #16776
Comments
Can you elaborate on what exactly didn't work? Seeing you code snippet may help us better understand the problem.
No. What you described sounds like a right approach, you cannot force the page send another request but you can send one via APIRequestContext or by evaluating Check out our Replay from HAR guide, it may work for your use case if you want to mock some requests. |
Minimum code snippet:
response from this request:
But in browser this response is not 50 lines but 1000 line of code. And how I can repeat it? |
and how you think? |
The response I'm getting locally is different from above. Most likely a bot detection kicks in on the server end because the request differs from what the browser sends, the intercepted request might lack some of the low-level network headers (e.g. sec-ch-* etc.). Circumventing bot detection is not a goal for playwright. You can sniff the request on the server end, compare it with the intercepted request and pass missing headers to page.request.get() manually. If you figure out what makes the server return different response or provide a reliable repro that we could run locally we can help further. |
I substituted headers and cookies from Playwright in the request, but I received a part of the code that was not loaded. As I understand it, I need to use js rendering to pass the bot anti-detection, that is, browsers do this and execute javascript code on the page and let me in. But I would like to do it via a server request. |
Closing as per above. If you don't want to perform the request outside the browser, you can always try fetching from within the page using |
What are the ways to repeat the request?
Example:
These two methods that I guessed about are purely crutches for my question - they don't work because I don't know exactly but need js rendering. Is it possible in the request handler to write, for example: route.repeat().
The text was updated successfully, but these errors were encountered: