Compare commits
No commits in common. "3f8cf91ac29c70901e3695d52c0fe34b044c25f2" and "02c8d2252f5cb75ce55fa50a58482c56ef521a70" have entirely different histories.
3f8cf91ac2
...
02c8d2252f
25
src/main.rs
25
src/main.rs
@ -1,15 +1,8 @@
|
||||
use fantoccini::{elements::Element, ClientBuilder, Locator};
|
||||
|
||||
const MAX_ANSWER_INDEX: u128 = 100000000;
|
||||
|
||||
struct Answer {
|
||||
upvotes: u32,
|
||||
author: String,
|
||||
content: String,
|
||||
}
|
||||
use fantoccini::{ClientBuilder, Locator};
|
||||
|
||||
// let's set up the sequence of steps we want the browser to take
|
||||
async fn get_answer() -> anyhow::Result<Element> {
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), fantoccini::error::CmdError> {
|
||||
let c = ClientBuilder::native()
|
||||
.connect("http://localhost:4444")
|
||||
.await
|
||||
@ -18,13 +11,9 @@ async fn get_answer() -> anyhow::Result<Element> {
|
||||
// first, go to the Wikipedia page for Foobar
|
||||
c.goto("https://stackoverflow.com/questions/78872368/how-to-set-up-webpack-devserver-config-to-build-another-target").await?;
|
||||
|
||||
let answer_loc = c.find(Locator::Css("answer")).await;
|
||||
// click "Foo (disambiguation)"
|
||||
let answer_loc = c.find(Locator::Id("answer-.*")).await?;
|
||||
dbg!(answer_loc);
|
||||
|
||||
c.close().await;
|
||||
Ok(answer_loc?)
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
dbg!(get_answer().await);
|
||||
c.close().await
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user