S
S
Semyon2021-03-02 20:34:35
Parsing
Semyon, 2021-03-02 20:34:35

Playwright: how to disable image loading and css?

To speed up the loading of pages, I want to disable the loading of photos and styles, but I did not find how to do this on playwright. Can you please tell me how this can be implemented? It will be great if in python) I understand that regardless of the PL, the essence is the same, but for some reason my brain stubbornly refuses to interpret the js syntax

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Semyon, 2021-03-02
@Hitreno

Eh, I wrote another question from the category of "badly googled."

Py code
context.route("**/*", lambda route: route.abort()
if route.request.resource_type == "image"
or route.request.resource_type == "stylesheet"
or route.request.resource_type == "svg"
else route.continue_())

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question