@@ -12,9 +12,11 @@ open DynamicObj
12
12
module PuppeteerSharpRendererOptions =
13
13
14
14
let mutable launchOptions = LaunchOptions()
15
-
16
15
launchOptions.Timeout <- 60000
17
16
17
+ let mutable localBrowserExecutablePath = None
18
+
19
+
18
20
type PuppeteerSharpRenderer () =
19
21
20
22
/// adapted from the original C# implementation by @ilyalatt : https://github.com/ilyalatt/Plotly.NET.PuppeteerRenderer
@@ -78,16 +80,25 @@ type PuppeteerSharpRenderer() =
78
80
/// Initalizes headless browser
79
81
let fetchAndLaunchBrowserAsync () =
80
82
async {
81
- use browserFetcher = new BrowserFetcher()
83
+ match PuppeteerSharpRendererOptions.localBrowserExecutablePath with
84
+ | None ->
85
+ use browserFetcher = new BrowserFetcher()
82
86
83
- let! revision = browserFetcher.DownloadAsync() |> Async.AwaitTask
87
+ let! revision = browserFetcher.DownloadAsync() |> Async.AwaitTask
84
88
85
- let launchOptions =
86
- PuppeteerSharpRendererOptions.launchOptions
89
+ let launchOptions =
90
+ PuppeteerSharpRendererOptions.launchOptions
87
91
88
- launchOptions.ExecutablePath <- revision.ExecutablePath
92
+ launchOptions.ExecutablePath <- revision.ExecutablePath
89
93
90
- return ! Puppeteer.LaunchAsync( launchOptions) |> Async.AwaitTask
94
+ return ! Puppeteer.LaunchAsync( launchOptions) |> Async.AwaitTask
95
+ | Some p ->
96
+ let launchOptions =
97
+ PuppeteerSharpRendererOptions.launchOptions
98
+
99
+ launchOptions.ExecutablePath <- p
100
+
101
+ return ! Puppeteer.LaunchAsync( launchOptions) |> Async.AwaitTask
91
102
}
92
103
93
104
/// Initalizes headless browser
0 commit comments