Package org.fluentlenium.core.css
Class CssSupportImpl
- java.lang.Object
-
- org.fluentlenium.core.css.CssSupportImpl
-
- All Implemented Interfaces:
CssSupport
public class CssSupportImpl extends Object implements CssSupport
Features related to CSS loaded in the active page.There is a retry logic trying to inject the CSS, using an underlying
JavascriptExecutor
, maximumMAX_SCRIPT_EXECUTION_RETRY_COUNT
times in case it fails, and waits forEXPLICIT_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
Constructors Constructor Description CssSupportImpl(JavascriptControl javascriptControl, AwaitControl awaitControl)
Creates a new implementation of css support.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
inject(String cssText)
Inject CSS into active page.void
injectResource(String cssResourceName)
Inject CSS classpath resource into active page.
-
-
-
Constructor Detail
-
CssSupportImpl
public CssSupportImpl(JavascriptControl javascriptControl, AwaitControl awaitControl)
Creates a new implementation of css support.- Parameters:
javascriptControl
- javascript control for the injectionawaitControl
- await control for waiting between injection retries
-
-
Method Detail
-
inject
public void inject(String cssText)
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
public void injectResource(String cssResourceName)
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
-
-