Skip to content

Commit

Permalink
port opt
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmindlin committed Jun 16, 2024
1 parent ac6e4e8 commit 5673ab3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ struct Args {

#[arg(long)]
debug: bool,

#[arg(short, long, default_value_t = 4444)]
port: usize,
}

async fn run(
Expand Down Expand Up @@ -51,7 +54,7 @@ async fn main() {

let child = Command::new("geckodriver")
.arg("--port")
.arg("4444")
.arg(args.port.to_string())
.stdout(std::process::Stdio::null())
.stderr(std::process::Stdio::null())
.spawn()
Expand All @@ -65,9 +68,10 @@ async fn main() {
let opts = serde_json::json!({ "args": ["--headless"] });
caps.insert("moz:firefoxOptions".into(), opts);
}
let conn_url = format!("http://localhost:{}", args.port);
let crawler = fantoccini::ClientBuilder::native()
.capabilities(caps)
.connect("http://localhost:4444")
.connect(&conn_url)
.await
.expect("error starting browser");

Expand Down

0 comments on commit 5673ab3

Please sign in to comment.