switched over to matching for css selector
This commit is contained in:
parent
85011038fa
commit
857a81478a
25
src/main.rs
25
src/main.rs
@ -1,8 +1,15 @@
|
|||||||
use fantoccini::{ClientBuilder, Locator};
|
use fantoccini::{elements::Element, ClientBuilder, Locator};
|
||||||
|
|
||||||
|
const MAX_ANSWER_INDEX: u128 = 100000000;
|
||||||
|
|
||||||
|
struct Answer {
|
||||||
|
upvotes: u32,
|
||||||
|
author: String,
|
||||||
|
content: String,
|
||||||
|
}
|
||||||
|
|
||||||
// let's set up the sequence of steps we want the browser to take
|
// let's set up the sequence of steps we want the browser to take
|
||||||
#[tokio::main]
|
async fn get_answer() -> anyhow::Result<Element> {
|
||||||
async fn main() -> Result<(), fantoccini::error::CmdError> {
|
|
||||||
let c = ClientBuilder::native()
|
let c = ClientBuilder::native()
|
||||||
.connect("http://localhost:4444")
|
.connect("http://localhost:4444")
|
||||||
.await
|
.await
|
||||||
@ -11,9 +18,13 @@ async fn main() -> Result<(), fantoccini::error::CmdError> {
|
|||||||
// first, go to the Wikipedia page for Foobar
|
// 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?;
|
c.goto("https://stackoverflow.com/questions/78872368/how-to-set-up-webpack-devserver-config-to-build-another-target").await?;
|
||||||
|
|
||||||
// click "Foo (disambiguation)"
|
let answer_loc = c.find(Locator::Css("answer")).await;
|
||||||
let answer_loc = c.find(Locator::Id("answer-.*")).await?;
|
|
||||||
dbg!(answer_loc);
|
|
||||||
|
|
||||||
c.close().await
|
c.close().await;
|
||||||
|
Ok(answer_loc?)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main() {
|
||||||
|
dbg!(get_answer().await);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user