[Feature Request]: Ability to Abort/Cancel Requests for Images, Stylesheets, Media, and Fonts
Checklist before requesting
- [x] I have searched for similar feature requests and didn't find a duplicate.
- [x] I have checked the documentation to confirm this feature doesn't already exist.
Problem Statement
Hiii
I've gone through the documentation but couldn't find a solution, so I'm reaching out here to ask.
Is there currently any support for aborting or canceling requests for images, stylesheets, media files, or fonts? Additionally, is there a way to wait specifically for a certain API response?
Please let me know if there’s anything related to this that I might have missed.
Thanks!
Proposed Solution
async def on_request(page, event): request_id = event['params']['requestId']
if event['params'].get('type') in ["Image", "Media", "Stylesheet", "Font"]:
page._execute_command(
FetchCommands.abort_request(request_id)
)
like playwright provides method to do that
if request.resource_type in ["image", "media", "stylesheet", "font"]:
await route.abort()
else:
await route.continue_()```
### Alternatives Considered
_No response_
### Additional Context
_No response_
### Importance
Nice to have
### Contribution
None
Hi @naimish33 , thanks for the suggestion! I'll work on this issue in the next few days
Done! Just install the new version and check the documentation
Ohh great, Thanks for the update.🎉🎉