Skip to content

Commit

Permalink
Only get build ID if executable path is not supplied. (#2801)
Browse files Browse the repository at this point in the history
* Only get build ID if executable path is not supplied.

fixes #2800

* Update version to 20.0.2
  • Loading branch information
AshIzat authored Oct 22, 2024
1 parent 71ff822 commit 924c71b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
19 changes: 12 additions & 7 deletions lib/PuppeteerSharp/Launcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,19 @@ public async Task<IBrowser> LaunchAsync(LaunchOptions options)

EnsureSingleLaunchOrConnect();
_browser = options.Browser;
var buildId = options.Browser switch

var executable = options.ExecutablePath;
if (executable == null)
{
SupportedBrowser.Firefox => await Firefox.GetDefaultBuildIdAsync().ConfigureAwait(false),
SupportedBrowser.Chrome or SupportedBrowser.ChromeHeadlessShell => Chrome.DefaultBuildId,
SupportedBrowser.Chromium => await Chromium.ResolveBuildIdAsync(BrowserFetcher.GetCurrentPlatform()).ConfigureAwait(false),
_ => throw new ArgumentException("Invalid browser"),
};
var executable = options.ExecutablePath ?? GetExecutablePath(options, buildId);
var buildId = options.Browser switch
{
SupportedBrowser.Firefox => await Firefox.GetDefaultBuildIdAsync().ConfigureAwait(false),
SupportedBrowser.Chrome or SupportedBrowser.ChromeHeadlessShell => Chrome.DefaultBuildId,
SupportedBrowser.Chromium => await Chromium.ResolveBuildIdAsync(BrowserFetcher.GetCurrentPlatform()).ConfigureAwait(false),
_ => throw new ArgumentException("Invalid browser"),
};
executable = GetExecutablePath(options, buildId);
}

Process = options.Browser switch
{
Expand Down
8 changes: 4 additions & 4 deletions lib/PuppeteerSharp/PuppeteerSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
<Description>Headless Browser .NET API</Description>
<PackageId>PuppeteerSharp</PackageId>
<PackageReleaseNotes></PackageReleaseNotes>
<PackageVersion>20.0.2</PackageVersion>
<ReleaseVersion>20.0.2</ReleaseVersion>
<AssemblyVersion>20.0.2</AssemblyVersion>
<FileVersion>20.0.2</FileVersion>
<PackageVersion>20.0.3</PackageVersion>
<ReleaseVersion>20.0.3</ReleaseVersion>
<AssemblyVersion>20.0.3</AssemblyVersion>
<FileVersion>20.0.3</FileVersion>
<SynchReleaseVersion>false</SynchReleaseVersion>
<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
<DebugType>embedded</DebugType>
Expand Down

0 comments on commit 924c71b

Please sign in to comment.