Disable Images in Selenium and Browserist#
Why Disable Images? Advantages and Disadvantages#
If you want to scrape a website that loads images, you can gain a performance boost by disabling images.
This is often done in combination with headless mode, since you can't see any graphics in a headless browser. On the other hand, the disadvantage is obviously that you can't observe what the browser is doing.
How to Configure#
Selenium#
With Selenium, each browser type has its own configuration:
Browserist#
Or use Browserist where the configuration is the same for all browser types βΒ less hassle as the configuration of Selenium is automatically handled in the background. Simply set disable_images=True
in the BrowserSettings
class:
Supported Browsers#
Note
Not all browsers support disabling of images well: Both Safari and Internet Explorer requires us to update global settings in the operating system that may impact how these browsers behave outside Browserist.
Browsers that support disabling of images:
Chrome | Edge | Firefox | Safari | Internet Explorer |
---|---|---|---|---|