MachinePublishers / jBrowserDriver

A programmable, embeddable web browser driver compatible with the Selenium WebDriver spec -- headless, WebKit-based, pure Java
Other
809 stars 143 forks source link

JBrowserDriver ignores CSS in Quick-Render-Mode #346

Closed Argelbargel closed 4 years ago

Argelbargel commented 5 years ago

Hi there,

up until 1.0.0RC1 the JBrowserDriver was downloading an parsing CSS-Files embedded via -Tags when Settings#quickRender() was true.

Since 1.0.1 this behaviour was changed and the extension css was added to StreamConnection#mediaExtensions which defines the extensions of files that are discarded in quick-render mode.

IMHO that is a bug as there are scenarios where one wants to test for correct application of CSS whether a javascript is correctly setting some style-class but still does not want to load all the images and other media embedded in the page.

My concrete use case is testing whether an element isDisplayed() in certain cases which fails when CSS gets discarded.

Currently the only workaround is disabling quick-render-mode.

Kind regards

Argelbargel commented 5 years ago

Okay. After taking a look at the "offending" commit, i thought this should restore the old behaviour:

Capabilities settings = Settings.builder()
                .headless(true)
                .quickRender(false)
                .blockMedia(true)
                .buildCapabilities()

I hoped this would load CSS-Files and block other media but it does not :-(

hollingsworthd commented 4 years ago

Thanks for pointing this out. Yeah I agree with you CSS rendering is too important to have it tied in with these other options. The point of blockMedia and quickRender are to eliminate images/video/etc which rarely are important in headless rendering. Blocking CSS is a rarer use case and should be its own option.

hollingsworthd commented 4 years ago

Released in v1.1.0-RC2 available now on Maven Central