glitch_123
glitch_123

Reputation: 119

TypeError when using undetected-chromedriver

I am using undetected-chromedriver library but when i run

import undetected_chromedriver as uc
driver = uc.Chrome()
driver.get('https://nowsecure.nl')

I , keep getting the below error:

[Process Process-1:
Traceback (most recent call last):
  File "C:\Users\DC\AppData\Local\Programs\Python\Python39\lib\multiprocessing\process.py", line 315, in _bootstrap
    self.run()
  File "C:\Users\DC\AppData\Local\Programs\Python\Python39\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\DC\AppData\Local\Programs\Python\Python39\lib\site-packages\undetected_chromedriver\dprocess.py", line 59, in _start_detached
    p = Popen([executable, *args], stdin=PIPE, stdout=PIPE, stderr=PIPE, **kwargs)
  File "C:\Users\DC\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 947, in __init__    
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\DC\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1356, in _execute_child
    args = list2cmdline(args)
  File "C:\Users\DC\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 561, in list2cmdline 
   for arg in map(os.fsdecode, seq):
  File "C:\Users\DC\AppData\Local\Programs\Python\Python39\lib\os.py", line 822, in fsdecode
    filename = fspath(filename)  # Does type-checking of `filename`.
TypeError: expected str, bytes or os.PathLike object, not NoneType](url)

How to solve this? Thanks

Upvotes: 1

Views: 2988

Answers (2)

Ahmed
Ahmed

Reputation: 11

chrome_options = uc.ChromeOptions()
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--disable-dev-shm-usage")
chrome_options.add_argument("--start-maximized")
chrome_options.add_argument('--disable-popup-blocking')

driver = uc.Chrome(options=chrome_options)

driver.get('https://nowsecure.nl')

Upvotes: 1

RobinFrcd
RobinFrcd

Reputation: 5426

This means the Chrome executable hasn't been found.

You'll need to specify the path to the browser when initializing uc.Chrome with browser_executable_path:

browser_executable_path: str, optional, default: None - use find_chrome_executable
    Path to the browser executable.
    If not specified, make sure the executable's folder is in $PATH

Upvotes: 3

Related Questions