What is the trade-off for disabling CSS in HTMLUnit?

I experienced slowness in HTMLUnit 2.12 and therefore disabled CSS as described in HTMLUnit: super slow execution? .

I want to understand what a compromise is. Does this mean that I cannot use the XPath selector? Are there other tradeoffs?

+7
source share
1 answer

XPath selectors only consider html / xml document. CSS does not affect your requests. If that were then, then it would have non-deterministic results based on any CSS rule.

As for CSS selectors and XPath selectors, you can safely use them without CSS preloading. Downloading them will not affect the result you get.

In order for CSS to influence your use of HTMLUnit, your code or the loaded JavaScript code depends on the computed style of the elements.

+3
source

All Articles