https://github.com/openbytedev/deadpool-fantoccini
Dead simple async session pool for fantoccini.
https://github.com/openbytedev/deadpool-fantoccini
Last synced: 6 months ago
JSON representation
Dead simple async session pool for fantoccini.
- Host: GitHub
- URL: https://github.com/openbytedev/deadpool-fantoccini
- Owner: OpenByteDev
- License: mit
- Created: 2021-10-21T17:18:47.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-06-07T11:28:59.000Z (almost 3 years ago)
- Last Synced: 2024-10-12T13:53:03.105Z (over 1 year ago)
- Language: Rust
- Size: 35.2 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# deadpool-fantoccini
[](https://github.com/OpenByteDev/deadpool-fantoccini/actions/workflows/ci.yml)
[](https://crates.io/crates/deadpool-fantoccini)
[](https://docs.rs/deadpool-fantoccini)
[](https://deps.rs/repo/github/openbytedev/deadpool-fantoccini)
[](https://github.com/OpenByteDev/deadpool-fantoccini/blob/master/LICENSE)
[`deadpool`](https://crates.io/crates/deadpool/0.9.0) is a dead simple async pool for connections and objects of any type.
This crate implements a deadpool manager for [`fantoccini`](https://crates.io/crates/fantoccini/0.17.6).
## Example
```rust
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](https://github.com/OpenByteDev/deadpool-fantoccini/blob/master/LICENSE) or http://opensource.org/licenses/MIT)