Interface IBrowserFetcher
- Namespace
- PuppeteerSharp
- Assembly
- PuppeteerSharp.dll
BrowserFetcher can download and manage different versions of Chromium.
public interface IBrowserFetcher : IDisposable
Examples
Example on how to use BrowserFetcher to download a specific version of Chromium and run Puppeteer against it:
var browserFetcher = Puppeteer.CreateBrowserFetcher();
var revisionInfo = await browserFetcher.DownloadAsync(BrowserData.Chrome.DefaultBuildId);
var browser = await await Puppeteer.LaunchAsync(new LaunchOptions { ExecutablePath = revisionInfo.ExecutablePath});
Properties
BaseUrl
A download host to be used.
string BaseUrl { get; set; }
Property Value
Browser
Gets the browser.
SupportedBrowser Browser { get; set; }
Property Value
CacheDir
Determines the path to download browsers to.
string CacheDir { get; set; }
Property Value
Platform
Gets the platform.
Platform Platform { get; set; }
Property Value
WebProxy
Proxy used by the WebClient in DownloadAsync(), DownloadAsync(string) and CanDownloadAsync(string).
IWebProxy WebProxy { get; set; }
Property Value
Methods
CanDownloadAsync(string)
The method initiates a HEAD request to check if the revision is available.
Task<bool> CanDownloadAsync(string buildId)
Parameters
buildId
stringA build to check availability.
Returns
DownloadAsync()
Downloads the revision.
Task<InstalledBrowser> DownloadAsync()
Returns
- Task<InstalledBrowser>
Task which resolves to the completed download.
DownloadAsync(BrowserTag)
Downloads the revision.
Task<InstalledBrowser> DownloadAsync(BrowserTag tag)
Parameters
tag
BrowserTagBrowser tag.
Returns
- Task<InstalledBrowser>
Task which resolves to the completed download.
DownloadAsync(string)
Downloads the revision.
Task<InstalledBrowser> DownloadAsync(string revision)
Parameters
revision
stringRevision.
Returns
- Task<InstalledBrowser>
Task which resolves to the completed download.
GetExecutablePath(string)
Gets the executable path.
string GetExecutablePath(string buildId)
Parameters
buildId
stringBrowser buildId.
Returns
- string
The executable path.
GetInstalledBrowsers()
A list of all browsers available locally on disk.
IEnumerable<InstalledBrowser> GetInstalledBrowsers()
Returns
- IEnumerable<InstalledBrowser>
The available browsers.
Uninstall(string)
Removes a downloaded browser.
void Uninstall(string buildId)
Parameters
buildId
stringBrowser to remove.
Events
DownloadProgressChanged
Occurs when download progress in DownloadAsync()/DownloadAsync(string) changes.
event DownloadProgressChangedEventHandler DownloadProgressChanged