Skip to main content

Crate chrome_for_testing

Crate chrome_for_testing 

Source
Expand description

§Chrome for Testing API Client

This crate provides programmatic access to “chrome-for-testing” JSON APIs, which are used to retrieve version details and other relevant information about Chrome and ChromeDriver for testing purposes.

§Modules Overview

  • chromedriver: ChromeDriver specific utilities, such as log level configuration.

§API Endpoints

The crate leverages the following JSON API endpoints:

  • Last Known Good Versions: Recent good versions for each release channel (Stable/Beta/Dev/Canary). Perfect if you just need the “latest stable” version for example.

  • Known Good Versions: All known good versions. Longer API response, not pre-grouped per release channel. Good fit if you have a hardcoded old version that you want to resolve a download URL for.

For detailed documentation on these APIs, see the official Chrome for Testing documentation.

§Features

  • Ease of Use: Simplifies interaction with Chrome’s testing-related APIs.
  • Type-Safe Deserialization: Automatically maps JSON responses to Rust structs for seamless API interaction.
  • Asynchronous Support: Fully asynchronous.

§Example Usage

#[tokio::main]
async fn main() {
    use chrome_for_testing::KnownGoodVersions;

    let client = reqwest::Client::new();
    match KnownGoodVersions::fetch(&client).await {
        Ok(data) => println!("Successfully fetched Chrome versions: {data:?}"),
        Err(e) => println!("Error occurred: {e:?}"),
    }
}

Modules§

chromedriver
ChromeDriver specific utilities, such as log level configuration.

Structs§

Download
Represents a download link for a specific platform.
KnownGoodDownloads
Download links for Chrome and ChromeDriver binaries.
KnownGoodVersions
Response structure for the “known good versions” API endpoint.
LastKnownGoodDownloads
Download links for Chrome, ChromeDriver, and Chrome Headless Shell binaries for various platforms.
LastKnownGoodVersions
Response structure for the “last known good versions” API endpoint.
ParseChannelError
Error returned when parsing a channel string fails.
ParsePlatformError
Error returned when parsing a platform string fails.
ParseVersionError
Error returned when parsing a version string fails.
Version
A version identifier.
VersionInChannel
A Chrome version entry with channel information.
VersionWithoutChannel
An entry of the “known good versions” API response, representing one version.

Enums§

Channel
Chrome release channel.
Error
Errors that can occur when using this crate.
Platform
Supported platforms for Chrome and ChromeDriver downloads.

Traits§

DownloadsByPlatform
Extension trait for download slices, providing platform-based lookup.
HasVersion
Trait for types that contain a version identifier.