Table of Contents

Method CreateAsync

Namespace
DotNetBrowser.Engine
Assembly
DotNetBrowser.Core.dll

CreateAsync()

Asynchronously creates and returns an IEngine instance.

public static Task<IEngine> CreateAsync()

Returns

Task<IEngine>

A task which returns an initialized Chromium engine on completion. The task can throw EngineInitializationException if the IEngine initialization has failed for some reason.

Remarks

Calling this method is equivalent to calling the CreateAsync(EngineOptions) method with the EngineOptions built by calling new EngineOptions.Builder().Build().

CreateAsync(EngineOptions)

Asynchronously creates and returns an IEngine instance.

public static Task<IEngine> CreateAsync(EngineOptions options)

Parameters

options EngineOptions

The EngineOptions instance that will be used for initializing the engine

Returns

Task<IEngine>

A task which returns an initialized Chromium engine on completion. The task can throw EngineInitializationException if the IEngine initialization has failed for some reason.

Examples

string dataDir = TestUtil.GenerateCustomFolderPath();
Debug.WriteLine($"Data directory: {dataDir}");
Directory.CreateDirectory(dataDir);

EngineOptions engineOptions = new EngineOptions.Builder
    {
        UserDataDirectory = dataDir
    }
   .Build();
IEngine engine = await EngineFactory.CreateAsync(engineOptions);

CreateAsync(RenderingMode)

Asynchronously creates and returns an IEngine instance.

public static Task<IEngine> CreateAsync(RenderingMode renderingMode)

Parameters

renderingMode RenderingMode

The RenderingMode that will be used for initializing the engine

Returns

Task<IEngine>

A task, which returns an initialized Chromium engine on completion. The task can throw EngineInitializationException if the IEngine initialization has failed for some reason.

Remarks

Calling this method is equivalent to calling the CreateAsync(EngineOptions) method with the EngineOptions built by calling new EngineOptions.Builder().Build() with the rendering mode specified.