2

I want to run high performance tests on chrome driver. They still require execution of javascript. But rendering the page and executing/parsing css, is just not necessary and a waste of time. How can I prevent chromedriver from rendering and/or loading the css? Run it fully headless.

I am aware of HTMLUnit as an alternative but it is extremely slow, and does terrible job with the javascript.

I did find Phantom Driver https://github.com/qa/arquillian-phantom-driver and I tested it but I would prefer to stick with chrome due to the extensions and amazing support I can find for it.

iordanis
  • 1,284
  • 2
  • 15
  • 28

1 Answers1

1

Chrome/chromedriver cannot run headless without some virtual screen like Xserver, and it can't not-render the html and css.

Mobrockers
  • 2,128
  • 1
  • 16
  • 28
  • You could intercept any network requests for css files and abort them. – stephentgrammer Apr 08 '22 at 16:46
  • Could you please elaborate how we can achieve this? – Caio Gomes Jun 30 '22 at 21:39
  • @stephentgrammer – Caio Gomes Jun 30 '22 at 21:47
  • I actually ended up needing to keep the css to get the results I expected, but was able to improve download performance by turning off popups with `--block-new-web-contents` and image downloads with `--blink-settings=imagesEnabled=false`. I'm using playwright, and it has the ability to abort requests: https://playwright.dev/python/docs/network#abort-requests – stephentgrammer Jul 06 '22 at 20:01