2

In my efforts to improve performance of my selenium testing application I was wondering if it is possible to avoid loading certain files such as images (jpg and png). The parameter "--disable-images" disable all images, including "gif", which in my canse can be a google analytics tag, and I must capture that.

sngtx
  • 39
  • 2
  • 3

1 Answers1

2

Yes, you can do it by specifying profile.managed_default_content_settings.image in ChromeOptions. Example:

chromeOptions = webdriver.ChromeOptions()
prefs = {"profile.managed_default_content_settings.images": 2}
chromeOptions.add_experimental_option("prefs", prefs)
driver = webdriver.Chrome(chrome_options=chromeOptions)

As for only for specific image formats, I don't think it's possible

Aldo Suwandi
  • 382
  • 1
  • 6
  • 20