You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use fantoccini::ClientBuilder;
use std::error::Error;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
// Launch a Firefox browser instance using WebDriver
let client = ClientBuilder::native()
.connect("http://localhost:4444")
.await?;
// Navigate to a website
client.goto("https://google.com/").await?;
Ok(())
}
When running the code multiple times, it results in a SessionNotCreated error with the following message:
Ah, yes, this is because Firefox's geckodriver doesn't allow concurrent sessions, combined with the fact that you're not calling and then awaitingClient::close which would cleanly terminate the previous session before the next one is started. See the paragraph in the documentation on Client. Adding a client.close.await? before you return Ok() should fix the issue :)
For higher-level operation, I recommend you use something like @stevepryde's thirtyfour, which will probably make it easier to do things like keep state over time.
Hello & thanks for your library!
I have the following issue with this code:
When running the code multiple times, it results in a SessionNotCreated error with the following message:
Error: SessionNotCreated(WebDriver { error: SessionNotCreated, message: "Session is already started", stacktrace: "" })
I have to kill/restart geckodriver to be able to run the code again.
Any ideas how to fix it?
Also, it would be really handy to have some code in the README that shows how to save / reuse session/profile information such as cookies.
Thanks a lot!
The text was updated successfully, but these errors were encountered: