Class WaitOptions
- Namespace
- CobaltPdf.Configuration
- Assembly
- CobaltPdf.dll
Base class for defining a wait strategy before PDF rendering.
public abstract class WaitOptions
- Inheritance
-
WaitOptions
- Inherited Members
Properties
DefaultNetworkIdle
The default. Waits for the network to be idle (no requests for 500ms).
public static WaitOptions DefaultNetworkIdle { get; }
Property Value
Methods
ForDelay(TimeSpan)
Waits for a fixed time delay.
public static WaitOptions ForDelay(TimeSpan delay)
Parameters
delayTimeSpan
Returns
ForJavaScript(string, TimeSpan?)
Waits for a JavaScript expression to become 'true'. The script is polled until it returns a truthy value.
public static WaitOptions ForJavaScript(string jsExpression, TimeSpan? timeout = null)
Parameters
jsExpressionstringThe JS expression (e.g., "window.myApp.isDataLoaded === true").
timeoutTimeSpan?An optional override for the wait timeout.
Returns
ForSelector(string, TimeSpan?)
Waits for a specific CSS selector to be visible on the page.
public static WaitOptions ForSelector(string selector, TimeSpan? timeout = null)
Parameters
selectorstringThe CSS selector (e.g., "#my-id", ".my-class").
timeoutTimeSpan?An optional override for the wait timeout.
Returns
ForSignal(TimeSpan)
Waits for a 'window.cobaltNotifyRender()' signal from JavaScript. This is the most robust way to handle complex, asynchronous scripts.
public static WaitOptions ForSignal(TimeSpan timeout)
Parameters
timeoutTimeSpanThe maximum time to wait for the signal.