LauncherBase
Namespace: PuppeteerSharp
public abstract class LauncherBase : IDisposableRepresents a Base process and any associated temporary user data directory that have created by Puppeteer and therefore must be cleaned up when no longer needed.
Inheritance: object
Implements: IDisposable
Derived: ChromeLauncher, FirefoxLauncher
Constructors
Section titled “Constructors”LauncherBase(string, LaunchOptions)
Section titled “LauncherBase(string, LaunchOptions)”protected LauncherBase(string executable, LaunchOptions options)Initializes a new instance of the LauncherBase class.
Parameters
| Name | Type | Description |
|---|---|---|
executable |
string | Full path of executable. |
options |
LaunchOptions | Options for launching Base. |
Properties
Section titled “Properties”EndPoint
Section titled “EndPoint”public string EndPoint { get; }Gets Base endpoint.
Value: string
HasExited
Section titled “HasExited”public bool HasExited { get; }Indicates whether Base process has exited.
Value: bool
IsExiting
Section titled “IsExiting”public bool IsExiting { get; }Indicates whether Base process is exiting.
Value: bool
Process
Section titled “Process”public Process Process { get; }Gets Base process details.
Value: Process
Methods
Section titled “Methods”Dispose()
Section titled “Dispose()”public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Dispose(bool)
Section titled “Dispose(bool)”protected virtual void Dispose(bool disposing)Disposes Base process and any temporary user directory.
Parameters
| Name | Type | Description |
|---|---|---|
disposing |
bool | Indicates whether disposal was initiated by Dispose() operation. |
EnsureExitAsync(TimeSpan?)
Section titled “EnsureExitAsync(TimeSpan?)”public Task EnsureExitAsync(TimeSpan? timeout)Asynchronously waits for graceful Base process exit within a given timeout period. Kills the Base process if it has not exited within this period.
Parameters
| Name | Type | Description |
|---|---|---|
timeout |
TimeSpan? | The maximum waiting time for a graceful process exit. |
Returns: Task — Task which resolves when the process is exited or killed.
~LauncherBase()
Section titled “~LauncherBase()”protected ~LauncherBase()Finalizes an instance of the LauncherBase class.
KillAsync()
Section titled “KillAsync()”public Task KillAsync()Asynchronously kills Base process.
Returns: Task — Task which resolves when the process is killed.
SetEnvVariables(IDictionary<string, string>, IDictionary<string, string>, IDictionary)
Section titled “SetEnvVariables(IDictionary<string, string>, IDictionary<string, string>, IDictionary)”protected static void SetEnvVariables(IDictionary<string, string> environment, IDictionary<string, string> customEnv, IDictionary realEnv)Set Env Variables.
Parameters
| Name | Type | Description |
|---|---|---|
environment |
IDictionary<string, string> | The environment. |
customEnv |
IDictionary<string, string> | The customEnv. |
realEnv |
IDictionary | The realEnv. |
StartAsync()
Section titled “StartAsync()”public Task StartAsync()Asynchronously starts Base process.
Returns: Task — Task which resolves when after start process begins.
WaitForExitAsync(TimeSpan?)
Section titled “WaitForExitAsync(TimeSpan?)”public Task<bool> WaitForExitAsync(TimeSpan? timeout)Waits for Base process exit within a given timeout.
Parameters
| Name | Type | Description |
|---|---|---|
timeout |
TimeSpan? | The maximum wait period. |
Returns: Task<bool> — true if Base process has exited within the given <code class=“paramref”>timeout</code>,
or false otherwise.
Made with love by Dario Kondratiuk