Package io.fluentlenium.core.css
Class CssSupportImpl
java.lang.Object
io.fluentlenium.core.css.CssSupportImpl
- All Implemented Interfaces:
CssSupport
Features related to CSS loaded in the active page.
There is a retry logic trying to inject the CSS, using an underlying
JavascriptExecutor
,
maximum MAX_SCRIPT_EXECUTION_RETRY_COUNT
times in case it fails, and waits for
EXPLICIT_WAIT_PERIOD
between each try.
The injection logic is stored in INJECTOR_JS_PATH
.
Currently neither the max retry count nor the amount of wait between each try is configurable.
-
Constructor Summary
ConstructorsConstructorDescriptionCssSupportImpl
(JavascriptControl javascriptControl, AwaitControl awaitControl) Creates a new implementation of css support. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Inject CSS into active page.void
injectResource
(String cssResourceName) Inject CSS classpath resource into active page.
-
Constructor Details
-
CssSupportImpl
Creates a new implementation of css support.- Parameters:
javascriptControl
- javascript control for the injectionawaitControl
- await control for waiting between injection retries
-
-
Method Details
-
inject
Description copied from interface:CssSupport
Inject CSS into active page.Additional escaping might be necessary depending on in what form the source if provided.
Example:
@Test public void testMethod() { css().inject("#location {display: none}"); css().inject("#location {\ndisplay: none\n}"); }
- Specified by:
inject
in interfaceCssSupport
- Parameters:
cssText
- css source to inject
-
injectResource
Inject CSS classpath resource into active page.Example:
@Test public void testMethod() { css().injectResource("/path/to/css/resource.css"); }
This implementation doesn't inject the provided resource as an external CSS
<link>
tag into the document, rather it injects the content of the resource itself.- Specified by:
injectResource
in interfaceCssSupport
- Parameters:
cssResourceName
- css classpath resource to inject
-