jonhoo / fantoccini

A high-level API for programmatically interacting with web pages through WebDriver.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

webdriver should not panic on invalid argument

Gentoli opened this issue · comments

commented
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

Ah, yes, that panic is over here:

panic!("unexpected webdriver error; {}", e);

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 yep that sounds good to me

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