jonhoo / jonhoo/fantoccini

Wrapping capabilities for initialization

Open
#44 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2k
Forks
135
PR merge metrics
No merged PRs in 30d

Description

Hi I want to use `with_capabilities` to create a new client, but not sure if doing it right. This is what I'm doing:

```rust
extern crate tokio;
extern crate futures;
extern crate fantoccini;
extern crate webdriver;
extern crate serde_json;

use fantoccini::{Client, Locator};
use futures::future::Future;
use webdriver::capabilities::Capabilities;

fn main() {
let mut cap = Capabilities::new();
let arg = serde_json::from_str("{\"args\": [\"-headless\"]}").unwrap();
cap.insert("moz:firefoxOptions".to_string(), arg);
let c = Client::with_capabilities("http://localhost:4444", cap);

// rest of the code down here...
}
```

If this is the right way to do it I was wondering if we could receive in the capabilities in another way that didn't involve me knowing about `webdriver` and `serde_json` and having to add them to my dependencies.

I'm open to making a PR if you prefer to discuss over actual code.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing Client::with_capabilities and the example's Capabilities construction, including the webdriver and serde_json dependencies shown in the issue. Determine whether the initialization API can accept capabilities without requiring those dependencies, and define completion as a documented, working initialization path that avoids them.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.