jonhoo / fantoccini

A high-level API for programmatically interacting with web pages through WebDriver.
Apache License 2.0
1.68k stars 125 forks source link

returning Prototype.Array shows in console.log but nothing from println. #219

Closed davehorner closed 1 year ago

davehorner commented 1 year ago
    let ret=client.execute("
    console.log(parent.someOperation().map(x => x.Prop()));
    return parent.someOperation().map(x => x.Prop());
    ",Vec::new()).await?;
        println!("chrome: {}",ret.as_str().unwrap_or(""));

I see the data in the chrome debugger after I click the [{...}] icon. I only see empty "result:" lines from then fantoccini Json value returned.

jonhoo commented 1 year ago

Hmm, this could be all sorts of things. I don't think is a bug in fantoccini. It might be a race condition in the code where the value is empty by time you get to the return. It might be that the value is empty at the time of the return, but by the time you look at the console it has resolve. Next thing to do would probably be to enable debug/verbose mode in your WebDriver to see what actually goes over the wire.