Class WaitFor
A managed wrapper of wait-for configurations. It also provides factory methods to set all related configurations as per desire waitfor type.
Inheritance
Namespace: IronPdf.Engines.Chrome
Assembly: IronPdf.dll
Syntax
public class WaitFor : Object
Working with Chrome engine in IronPDF runs through WaitFor. It represents managed wrapper of wait-for configurations.
WaitFor matters when an application needs to configure or invoke Chrome engine from C# code. The class encapsulates the related options and behavior in a single object that is set up once and reused across render or processing calls. Typical scenarios include batch generation pipelines, templated document workflows, and integration with existing C# document services.
To use WaitFor, instantiate or obtain it from the relevant entry point in the IronPDF C# API. Key methods include AllFontsLoaded, HtmlElementByClassName, HtmlElementById, HtmlElementByName. Assign options or invoke methods on the instance to configure or perform the operation. The waitfor covers typical usage in C# end to end.
using IronPdf;
// Obtain WaitFor from the relevant entry point in the IronPDF API
void Configure(WaitFor instance)
{
instance.AllFontsLoaded();
}For the broader workflow, see the IronPDF C# documentation for related how-to guides and examples. For broader context, the Chrome engine portion of the IronPDF C# API contains related types that work with WaitFor directly. WaitFor exposes additional members beyond those highlighted above; the reference tables on this page list the full set. In application code, treat WaitFor as a configured object that is constructed once and reused across operations rather than instantiated per call. Configuration is generally idempotent: assigning the same property value twice has the same effect as assigning it once. For diagnostic purposes, inspect the relevant WaitFor property after each operation to confirm the configured state. See the constructors, properties, and methods tables below for the complete API surface of WaitFor. Application code typically obtains or instantiates a single WaitFor and shares it across multiple IronPDF operations rather than recreating it per call.
Methods
AllFontsLoaded(Int32)
This method proceeds rendering by waiting until all of its fonts have been loaded. Such font types can local, remote, or google web fonts.
Declaration
public void AllFontsLoaded(int maxWaitTime = 10000)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | maxWaitTime | maximum wait time (in ms) until it forces rendering. Default is IronPdf.Engines.Chrome.WaitFor.DefaultMaxWaitTime. |
HtmlElementByClassName(String, Int32)
This method proceeds rendering by waiting until it finds the HTML element whose the class name as of the specified one.
Related JavaScript API that works similarly to this method is getElementsByClassName() but effective only for first found element from the result. Instead it makes a query directly via
document.querySelector() as it calls HtmlQuerySelector(String, Int32) internally.
Declaration
public void HtmlElementByClassName(string classAttribName, int maxWaitTime = 10000)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | classAttribName | Target element's class attribute name. Class attribute name token must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), and underscores ("_"). |
| System.Int32 | maxWaitTime | Maximum wait time (in ms) until it forces rendering. Default is IronPdf.Engines.Chrome.WaitFor.DefaultMaxWaitTime. |
Exceptions
| Type | Condition |
|---|---|
| IronPdfInputException | Thrown if input name is invalid not according to HTML name and Id naming rule. |
HtmlElementById(String, Int32)
This method proceeds rendering by waiting until it finds the HTML element that has the same id as specified one.
Related JavaScript API that works similarly to this method is getElementById() but instead it makes a query directly via
document.querySelector() as it calls HtmlQuerySelector(String, Int32) internally.
Declaration
public void HtmlElementById(string id, int maxWaitTime = 10000)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | id | Target element Id. Id token must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). |
| System.Int32 | maxWaitTime | Maximum wait time (in ms) until it forces rendering. Default is IronPdf.Engines.Chrome.WaitFor.DefaultMaxWaitTime. |
Exceptions
| Type | Condition |
|---|---|
| IronPdfInputException | Thrown if input id is invalid not according to HTML name and Id naming rule. |
HtmlElementByName(String, Int32)
This method proceeds rendering by waiting until it finds the element with the attribute name as of the specified one.
Related JavaScript API that works similarly to this method is getElementsByName() but effective only for first found element from the result. Instead it makes a query directly via
document.querySelector() as it calls HtmlQuerySelector(String, Int32) internally.
Declaration
public void HtmlElementByName(string name, int maxWaitTime = 10000)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Target element name. Name token must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). |
| System.Int32 | maxWaitTime | Maximum wait time (in ms) until it forces rendering. Default is IronPdf.Engines.Chrome.WaitFor.DefaultMaxWaitTime. |
Exceptions
| Type | Condition |
|---|---|
| IronPdfInputException | Thrown if input name is invalid not according to HTML name and Id naming rule. |
HtmlElementByTagName(String, Int32)
This method proceeds rendering by waiting until it finds the HTML element that itself has the same tag name as of specified one.
Related JavaScript API that works similarly to this method is getElementsByTagName() but effective only for first found element from the result. Instead it makes a query directly via
document.querySelector() as it calls HtmlQuerySelector(String, Int32) internally.
Declaration
public void HtmlElementByTagName(string tagName, int maxWaitTime = 10000)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | tagName | Target element's tag name. Tag name token must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). |
| System.Int32 | maxWaitTime | Maximum wait time (in ms) until it forces rendering. Default is IronPdf.Engines.Chrome.WaitFor.DefaultMaxWaitTime. |
Exceptions
| Type | Condition |
|---|---|
| IronPdfInputException | Thrown if input name is invalid not according to HTML name and Id naming rule. |
HtmlQuerySelector(String, Int32)
This method proceeds rendering by waiting until it finds the HTML element via the specified query string which is executed by a JavaScript function
document.querySelector().
Declaration
public void HtmlQuerySelector(string htmlQueryStr, int maxWaitTime = 10000)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | htmlQueryStr | HTML element query string to query for with Javascript's document.querySelector() |
| System.Int32 | maxWaitTime | Maximum wait time (in ms) until it forces rendering. Default is IronPdf.Engines.Chrome.WaitFor.DefaultMaxWaitTime. |
JavaScript(Int32)
This method proceeds rendering by waiting until user calls IronPdf's internal JavaScript function
window.ironpdf.notifyRender().
Declaration
public void JavaScript(int maxWaitTime = 10000)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | maxWaitTime | Maximum wait time in milliseconds until it forces rendering. Default value is IronPdf.Engines.Chrome.WaitFor.DefaultMaxWaitTime |
NetworkIdle(Int32, Int32, Int32)
This method proceeds rendering by waiting until it internally detects a network idle event when there is no network activity after at least specified networkIdleDuration as well as at maximum of maxNumAllowedInflight inflight (outstanding) network requests.
Declaration
public void NetworkIdle(int networkIdleDuration, int maxNumAllowedInflight, int maxWaitTime = 10000)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | networkIdleDuration | Duration of time in milliseconds to regard as network idle event |
| System.Int32 | maxNumAllowedInflight | Maximum number of allowed inflight network requests to not invalidate network idle event |
| System.Int32 | maxWaitTime | Maximum wait time in milliseconds until it forces rendering. Default value is IronPdf.Engines.Chrome.WaitFor.DefaultMaxWaitTime |
NetworkIdle0(Int32)
This method proceeds rendering by waiting until it internally detects a network idle event when there is no network activity. after at least 500ms as well as no inflight (outstanding) network requests.
Declaration
public void NetworkIdle0(int maxWaitTime = 10000)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | maxWaitTime | Maximum wait time in milliseconds until it forces rendering. Default value is IronPdf.Engines.Chrome.WaitFor.DefaultMaxWaitTime |
NetworkIdle2(Int32)
This method proceeds rendering by waiting until it internally detects a network idle event when there is no network activity after at least 500ms as well as at maximum of 2 inflight (outstanding) network request.
Declaration
public void NetworkIdle2(int maxWaitTime = 10000)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | maxWaitTime | Maximum wait time in milliseconds until it forces rendering. Default value is IronPdf.Engines.Chrome.WaitFor.DefaultMaxWaitTime |
PageLoad()
Basically it waits for nothing, but will render as soon as the page loaded.
There is no need to call this method if user desires to normally render the page. It is mostly useful to reset WaitFor configurations back to wait for nothing.
Declaration
public void PageLoad()
RenderDelay(Int32)
This method proceeds rendering by introducing an initial delay before rendering.
Declaration
public void RenderDelay(int delay)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | delay | Delay time in milliseconds before rendering |