Closed mostafamdy closed 1 month ago
I tried this code:
def route_handler(route):
request = route.request
url = request.url.lower()
print(url)
if ".png" in url or ".ico" in url:
route.abort()
print('Aborted')
page.route('**/*', route_handler)
some images are successfully blocked and others don't seem to trigger the function. The URLs aren't being printed, although they are visible in both Burp Suite and the browser.
this website do many requests at the same time so may be playwright is vulnerable to race condition?
Would it be possible to share a full reproduction with us? Ideally a script which we can run locally with expected and actual outcome.
Closing as per above. Feel free to re-file with a working reproduction.
Version
1.45.1
Steps to reproduce
I attempted to block image (
.png
) and monitor network traffic using Burp Suite Proxy I observed that these requests were still being made, as shown by Burp SuiteCode Used to Abort .png Requests:
page.route("**/*.png", lambda route: route.abort())
Proxy Setup with Burp Suite:
I configured Playwright to use Burp Suite as a proxy with the following parameters:
Expected behavior
.
Actual behavior
.
Additional context
No response
Environment