pydoll icon indicating copy to clipboard operation
pydoll copied to clipboard

[Feature Request]: Ability to Abort/Cancel Requests for Images, Stylesheets, Media, and Fonts

Open naimish33 opened this issue 8 months ago • 1 comments

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

naimish33 avatar Apr 23 '25 13:04 naimish33

Hi @naimish33 , thanks for the suggestion! I'll work on this issue in the next few days

thalissonvs avatar Apr 24 '25 16:04 thalissonvs

Done! Just install the new version and check the documentation

thalissonvs avatar Jun 08 '25 03:06 thalissonvs

Ohh great, Thanks for the update.🎉🎉

naimish33 avatar Jun 09 '25 06:06 naimish33