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
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 |