Skip to content

Commit

Permalink
Fix reuse chrome docs (#2646)
Browse files Browse the repository at this point in the history
* Fix reuse chrome docs

* Docs changes

---------

Co-authored-by: GitHub Action <[email protected]>
  • Loading branch information
kblok and actions-user authored May 23, 2024
1 parent 1b22369 commit 3a2a395
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docfx_project/examples/DownloadFetcher.Download.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ await using (var browser = await Puppeteer.LaunchAsync(new()
Console.WriteLine("Export completed");
}
```
<sup><a href='https://github.com/hardkoded/puppeteer-sharp/blob/master/lib/PuppeteerSharp.Tests/Browsers/Chrome/ChromeDataTests.cs#L14-L49' title='Snippet source file'>snippet source</a> | <a href='#snippet-CustomVersionsExample' title='Start of snippet'>anchor</a></sup>
<sup><a href='https://github.com/hardkoded/puppeteer-sharp/blob/master/lib/PuppeteerSharp.Tests/Browsers/Chrome/ChromeDataTests.cs#L24-L59' title='Snippet source file'>snippet source</a> | <a href='#snippet-CustomVersionsExample' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->
```
8 changes: 6 additions & 2 deletions docfx_project/examples/ReuseChrome.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ from a location where it was previously downloaded instead of from the default l

Use `BrowserFetcherOptions` to specify the full path for where to download Chrome.

```
<!-- snippet: ReuseChromeExample -->
<a id='snippet-ReuseChromeExample'></a>
```cs
var downloadPath = "/Users/dario/chrome";
var browserFetcherOptions = new BrowserFetcherOptions { Path = downloadPath };
using var browserFetcher = new BrowserFetcher(browserFetcherOptions);
var browserFetcher = new BrowserFetcher(browserFetcherOptions);
var installedBrowser = await browserFetcher.DownloadAsync();
```
<sup><a href='https://github.com/hardkoded/puppeteer-sharp/blob/master/lib/PuppeteerSharp.Tests/Browsers/Chrome/ChromeDataTests.cs#L14-L19' title='Snippet source file'>snippet source</a> | <a href='#snippet-ReuseChromeExample' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Use `Puppeteer.LaunchAsync()` with `LaunchOptions` with the `LaunchOptions.ExecutablePath` property set to the
fully qualified path to the Chrome executable.
Expand Down
10 changes: 10 additions & 0 deletions lib/PuppeteerSharp.Tests/Browsers/Chrome/ChromeDataTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ namespace PuppeteerSharp.Tests.Browsers.Chrome
{
public class ChromeDataTests
{
public async Task ReuseChromeExample()
{
#region ReuseChromeExample
var downloadPath = "/Users/dario/chrome";
var browserFetcherOptions = new BrowserFetcherOptions { Path = downloadPath };
var browserFetcher = new BrowserFetcher(browserFetcherOptions);
var installedBrowser = await browserFetcher.DownloadAsync();
#endregion
}

public async Task Usage()
{
#region CustomVersionsExample
Expand Down

0 comments on commit 3a2a395

Please sign in to comment.