Rust-undetected-chromedriver icon indicating copy to clipboard operation
Rust-undetected-chromedriver copied to clipboard

Where does std::path::Path("chromedriver") check?

Open bceballos opened this issue 1 year ago • 5 comments

Very much a non issue but I'm confused as to where it's checking for chromedriver as it doesn't seem to be detecting it when it's installed in the regular chrome folder and neither in the same folder as the .rs file.

bceballos avatar Apr 22 '24 19:04 bceballos

Very much a non issue but I'm confused as to where it's checking for chromedriver as it doesn't seem to be detecting it when it's installed in the regular chrome folder and neither in the same folder as the .rs file.

Have you managed to sort it out?

itehax avatar May 03 '24 08:05 itehax

Very much a non issue but I'm confused as to where it's checking for chromedriver as it doesn't seem to be detecting it when it's installed in the regular chrome folder and neither in the same folder as the .rs file.

Have you managed to sort it out?

i have the same issue. chrome is installed

ChromeDriver does not exist! Fetching... Getting installed Chrome version... thread 'main' panicked at /home/arch/.cargo/registry/src/index.crates.io-6f17d22bba1 5001f/undetected-chromedriver-0.1.2/src/lib.rs:18:43: called Result::unwrap()on anErrvalue: Os { code: 2, kind: NotFound, message: "No such file or directory" } note: run withRUST_BACKTRACE=1environment variable to display a backtrace

cashmeresamurai avatar May 03 '24 12:05 cashmeresamurai

It's an error in the download step..it's open a pr to fix that but apparently the owner of the repo forgot about that. To fix that at the moment,if you want to use the crate,download manually chromedriver and place it in the project directory.

itehax avatar May 07 '24 07:05 itehax

The Google Chrome and ChromeDriver paths can be set using the environment variables GOOGLE_CHROME_BIN and CHROME_DRIVER respectively.

If you have them installed globally, you can either export them in the terminal or prefix the cargo run command with the variables as shown below:

export CHROME_DRIVER=$(which chromedriver)

GOOGLE_CHROME_BIN=/usr/bin/google-chrome-stable cargo run

I encountered the same error for both ChromeDriver and Chrome itself. I installed Chrome via yay, and my binary had -stable appended to the name (google-chrome-stable), which caused some headache

HamishFleming avatar Sep 13 '24 05:09 HamishFleming

It seems to pick up neither GOOGLE_CHROME_BIN nor CHROME_DRIVER environment variables for me, and I can't immediately see where it would even do that in the code as it seems to always look for chromdriver only in the current working directory! For finding out the Google Chrome version in get_chrome_version, it uses Command::new which could search the path if given a binary name. However, it's always looking for the absolute path /usr/bin/google-chrome, so I also can't see how that could pick up the environment variable.

I just ended up copying the chromedriver to the current directory (the patched chromedriver doesn't get updated if you never remove the generated patched version, so symlinking wouldn't help you keep it up to date), that way it never calls the get chrome function, so it actually works and opens the normal Google Chrome associated with the chromedriver binary I copied.

xuiqzy avatar Apr 21 '25 17:04 xuiqzy