ultrafunkamsterdam / undetected-chromedriver

Custom Selenium Chromedriver | Zero-Config | Passes ALL bot mitigation systems (like Distil / Imperva/ Datadadome / CloudFlare IUAM)
https://github.com/UltrafunkAmsterdam/undetected-chromedriver
GNU General Public License v3.0
9.82k stars 1.15k forks source link

"TypeError: Binary Location Must be a String" on Linux Mint with basic code #2011

Open laoraryn opened 1 month ago

laoraryn commented 1 month ago

Hi, I found this library today and I've been trying to implement it for several hours. I started with the basic code in the README, and also tried the code in the pinned message on the discussion board, but neither work. I keep getting the TypeError in the title above. I see several other issues opened for similar issues, none of which have any solutions posted - 1, 2, 3.

I'm running Linux Mint 21.3 Cinnamon and Python 3.10.12

My code:

import undetected_chromedriver as uc
driver = uc.Chrome()
driver.get('https://www.google.com')

The output:

Exception has occurred: TypeError
Binary Location Must be a String
  File "xxx", line 2, in <module>
    driver = uc.Chrome()
             ^^^^^^^^^^^
TypeError: Binary Location Must be a String

Confirmation of versions, locations from command line:

$ google-chrome --version
Google Chrome 128.0.6613.119 

$ chromedriver --version
ChromeDriver 128.0.6613.119 (6e439cfca4deda5954b0c74cde9b521c03cb31ad-refs/branch-heads/6613@{#1464})

$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

$ whereis google-chrome
google-chrome: /usr/bin/google-chrome /usr/share/man/man1/google-chrome.1.gz

$ whereis chromedriver
chromedriver: /usr/bin/chromedriver

I also found this thread with a solution that appeared to work for others, however it just gives me a different error:

My code:

import undetected_chromedriver as uc
options = uc.ChromeOptions()
driver = uc.Chrome(options = options, browser_executable_path="/usr/bin/google-chrome", driver_executable_path="/tmp/chromedriver")
driver.get('https://nowsecure.nl')

The output:

Exception has occurred: FileNotFoundError
[Errno 2] No such file or directory: '/tmp/chromedriver'
  File "xxx", line 3, in <module>
    driver = uc.Chrome(options = options, browser_executable_path="/usr/bin/chromium", driver_executable_path="/tmp/chromedriver")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/chromedriver'

(I tried it with /usr/bin/chromedriver also, just in case, but I got the same FileNotFoundError.)

I'm relatively new to Chromedriver and Linux in general, so it's entirely possible I'm missing something obvious, but I've been hitting my head against this for too long! Any help would be appreciated :)

jasongst commented 1 month ago

Hello, I resolved the problem on Ubuntu by installing chromium with snap sudo snap install chromium

I think snap is not available on Linux Mint but you can still install it with sudo apt install snapd

I hope this solves your problem

laoraryn commented 1 month ago

Hello, I resolved the problem on Ubuntu by installing chromium with snap sudo snap install chromium

I think snap is not available on Linux Mint but you can still install it with sudo apt install snapd

I hope this solves your problem

Thanks for the suggestion! Unfortunately it didn't solve the problem for me, I'm still getting the same error :/