deadpool-fantoccini

Crates.iodeadpool-fantoccini
lib.rsdeadpool-fantoccini
version0.3.0
sourcesrc
created_at2021-10-21 17:24:28.310744
updated_at2023-06-07 11:36:15.890886
descriptionDead simple async session pool for fantoccini.
homepage
repositoryhttps://github.com/OpenByteDev/deadpool-fantoccini
max_upload_size
id468645
size19,644
OpenByte (OpenByteDev)

documentation

https://docs.rs/deadpool-fantoccini

README

deadpool-fantoccini

CI crates.io Documentation dependency status MIT

deadpool is a dead simple async pool for connections and objects of any type.

This crate implements a deadpool manager for fantoccini.

Example

use deadpool_fantoccini::{Manager, Pool, PoolShutdown};
use fantoccini::{ClientBuilder, Locator};

#[tokio::main]
async fn main() {
    let manager = Manager::new("http://localhost:4444", ClientBuilder::native());
    let pool = Pool::builder(manager).max_size(5).build().unwrap();

    let mut client = pool.get().await.unwrap();
    client.goto("http://example.org/").await.unwrap();
    let title = client
        .find(Locator::Css("h1"))
        .await
        .unwrap()
        .text()
        .await
        .unwrap();
    assert_eq!(title, "Example Domain");
    drop(client);

    // cleanly closes all sessions (all sessions have to be returned to the pool beforehand.)
    pool.shutdown().await.unwrap();
}

License

Licensed under MIT license (LICENSE or http://opensource.org/licenses/MIT)

Commit count: 44

cargo fmt