cookie notice seems to be optional
This commit is contained in:
parent
d7c865663b
commit
4588d5b434
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -910,7 +910,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nzz-cookie"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap",
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "nzz-cookie"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
edition = "2021"
|
||||
license = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
|
@ -22,7 +22,7 @@ pub async fn run(args: Config, pw: &str) -> Result<()> {
|
||||
let (stop_tx, stop_rx) = oneshot::channel();
|
||||
let driver_handle = geckodriver::run(stop_rx).await?;
|
||||
|
||||
let driver_args = json!({ "moz:firefoxOptions": {"args": ["-headless"]} });
|
||||
let driver_args = json!({ "moz:firefoxOptions": {"args": []} });
|
||||
|
||||
let client = ClientBuilder::native()
|
||||
.capabilities(driver_args.as_object().unwrap().clone())
|
||||
@ -32,12 +32,16 @@ pub async fn run(args: Config, pw: &str) -> Result<()> {
|
||||
client.goto(LOGIN_URL).await?;
|
||||
|
||||
sleep(Duration::from_millis(500)).await;
|
||||
let fu_open_button: Element = element_from_css(&client, ".cmpboxbtncustom").await?;
|
||||
fu_open_button.click().await?;
|
||||
|
||||
let fu_button: Element = element_from_css(&client, ".cmpboxbtn.cmpboxbtnyes.cmpboxbtnyescustomchoices.cmptxt_btn_save").await?;
|
||||
sleep(Duration::from_millis(500)).await;
|
||||
fu_button.click().await?;
|
||||
// Sometimes cookie notice has to bee accepted, not sure when though
|
||||
if client.find(Locator::Css(".cmpboxbtncustom")).await.is_ok() {
|
||||
let fu_open_button: Element = element_from_css(&client, ".cmpboxbtncustom").await?;
|
||||
fu_open_button.click().await?;
|
||||
|
||||
let fu_button: Element = element_from_css(&client, ".cmpboxbtn.cmpboxbtnyes.cmpboxbtnyescustomchoices.cmptxt_btn_save").await?;
|
||||
sleep(Duration::from_millis(500)).await;
|
||||
fu_button.click().await?;
|
||||
}
|
||||
|
||||
|
||||
let login_button: Element = element_from_css(&client, ".fup-menu-login-container").await?;
|
||||
|
Loading…
Reference in New Issue
Block a user