fantoccini icon indicating copy to clipboard operation
fantoccini copied to clipboard

webdriver should not panic on invalid argument

Open Gentoli opened this issue 3 years ago • 3 comments

thread 'main' panicked at 'unexpected webdriver error; webdriver returned error: invalid argument: user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir', C:\Users\<>\.cargo\registry\src\github.com-1ecc6299db9ec823\fantoccini-0.19.1\src\session.rs:585:17

example:

    let mut caps = DesiredCapabilities::chrome();
    caps.set_binary(r"C:\Program Files\Google\Chrome Beta\Application\chrome.exe")?;
    caps.add_chrome_arg(r"--user-data-dir=C:\Users\<>\IdeaProjects\<>\chrome\userdata")?;
    caps.add_chrome_arg("--profile-directory=profile1")?;
    caps.add_chrome_arg("--ignore-certificate-errors")?;

    WebDriver::new("http://localhost:9515", caps).await

version: 0.19.1

Gentoli avatar Jul 08 '22 06:07 Gentoli

Ah, yes, that panic is over here: https://github.com/jonhoo/fantoccini/blob/761a68ccf042deca0a0496ea8c3e89a96b266c08/src/session.rs#L585

It's specifically to deal with cases where we get an error from the webdriver host that doesn't conform to the standard as far as we know. It may make sense to just add an error variant specifically for that that we can then propagate instead. cc @stevepryde — what do you think?

jonhoo avatar Jul 14 '22 11:07 jonhoo

@jonhoo yep that sounds good to me

stevepryde avatar Jul 14 '22 11:07 stevepryde

@Gentoli I'm a little short on spare time these days, but happy to look at a PR if you have a chance!

jonhoo avatar Jul 14 '22 11:07 jonhoo