Code Monkey home page Code Monkey logo

Comments (4)

jonhoo avatar jonhoo commented on May 27, 2024 1

You could also stick a call to wait_for_navigation inside that loop. That should help.

from fantoccini.

jonhoo avatar jonhoo commented on May 27, 2024

Hmm, that's strange. It seems to work fine for me?

extern crate fantoccini;
extern crate futures;
extern crate tokio_core;

use fantoccini::Client;

fn main() {
    let mut core = tokio_core::reactor::Core::new().unwrap();
    let c = Client::new("http://127.0.0.1:4444", &core.handle());
    let c = core.run(c).unwrap();

    core.run(c.goto("https://www.goteborgenergi.se/Mina_sidor"))
        .unwrap();
    for _ in 0..20 {
        println!("{:?}", core.run(c.current_url()));
        ::std::thread::sleep(::std::time::Duration::from_millis(100));
    }
    core.run(c.close()).unwrap();
}
$ cargo +nightly r
   Compiling y v0.1.0 (file:///home/jon/tmp/y)
    Finished dev [unoptimized + debuginfo] target(s) in 4.9 secs
     Running `target/debug/y`
Ok("https://www.goteborgenergi.se/my.policy")
Ok("https://www.goteborgenergi.se/my.policy")
Ok("https://www.goteborgenergi.se/my.policy")
Ok("https://www.goteborgenergi.se/my.policy")
Ok("https://www.goteborgenergi.se/my.policy")
Ok("https://www.goteborgenergi.se/my.policy")
Ok("https://www.goteborgenergi.se/my.policy")
Ok("https://idpaut.service.tieto.com/idp/gbgenergi/authenticate/authGbgF51UnPw")
Ok("https://idpaut.service.tieto.com/idp/gbgenergi/authenticate/authGbgF51UnPw")
Ok("https://idpaut.service.tieto.com/idp/gbgenergi/authenticate/authGbgF51UnPw")
Ok("https://idpaut.service.tieto.com/idp/gbgenergi/authenticate/authGbgF51UnPw")
Ok("https://idpaut.service.tieto.com/idp/gbgenergi/authenticate/authGbgF51UnPw")
Ok("https://idpaut.service.tieto.com/idp/gbgenergi/authenticate/authGbgF51UnPw")
Ok("https://idpaut.service.tieto.com/idp/gbgenergi/authenticate/authGbgF51UnPw")
Ok("https://idpaut.service.tieto.com/idp/gbgenergi/authenticate/authGbgF51UnPw")
Ok("https://idpaut.service.tieto.com/idp/gbgenergi/authenticate/authGbgF51UnPw")
Ok("https://idpaut.service.tieto.com/idp/gbgenergi/authenticate/authGbgF51UnPw")
Ok("https://idpaut.service.tieto.com/idp/gbgenergi/authenticate/authGbgF51UnPw")
Ok("https://idpaut.service.tieto.com/idp/gbgenergi/authenticate/authGbgF51UnPw")
Ok("https://idpaut.service.tieto.com/idp/gbgenergi/authenticate/authGbgF51UnPw")

Or am I missing something?

from fantoccini.

mhristache avatar mhristache commented on May 27, 2024

It seems I did not wait long enough. I was calling current_url() 2-3 times immediately after goto()and then it was always returning the intermediary url.

I will try adding a loop and check the current_url() until it gets to the authentication page.

Thanks a lot for your help.

from fantoccini.

jonhoo avatar jonhoo commented on May 27, 2024

Sure thing! For what it's worth, it looks like chromedriver gets to the final page a great deal faster than geckodriver does. Don't know if it matters to you though :)

from fantoccini.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.