Skip to content

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

Closed
@naimish33

Description

@naimish33

Checklist before requesting

  • I have searched for similar feature requests and didn't find a duplicate.
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions