Undetected_chromedriver path

I’m trying to run some code that uses undetected_chromedriver but I’m getting the following error:

Traceback (most recent call last):
  File "main.py", line 29, in <module>
    driver = uc.Chrome(options=options)
  File "/home/runner/firstReplit/venv/lib/python3.10/site-packages/undetected_chromedriver/__init__.py", line 421, in __init__
    browser = subprocess.Popen(
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/subprocess.py", line 971, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/subprocess.py", line 1722, in _execute_child
    and os.path.dirname(executable)
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/posixpath.py", line 152, in dirname
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

Hello, @allexbrunoabs, welcome to the replit ask the community. Can you please send a like of your code? It is so we can help you better. Thank you,

Hello! Of course. Sorry for the delay!

import undetected_chromedriver as uc
import asyncio
import time
import csv
import json
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from fake_useragent import UserAgent

# create a new undetected Chromedriver instance
options = uc.ChromeOptions()

# set options to run Chromedriver in headless mode
options.add_argument('--headless')
options.add_argument('--disable-gpu')

# set options to prevent Chrome from showing the "Chrome is being controlled by automated test software" notification
options.add_argument('--disable-logging')
options.add_argument('--disable-extensions')
options.add_argument('--disable-infobars')
options.add_argument('--disable-blink-features=AutomationControlled')

# set up user agent rotation
ua = UserAgent()
options.add_argument(f'user-agent={ua.random}')

# create a new undetected Chromedriver instance with the specified options
driver = uc.Chrome(options=options)

driver.get("https://www.target.com")
time.sleep(5)
driver.delete_all_cookies()
time.sleep(5)

# set up delay between requests
delay = 6

productlinks = []

async def fetch_data(link, idx):
    u = driver.get(link)
    time.sleep(delay)

    try:
        titleValue = driver.find_element(By.XPATH, '//h1[@data-test="product-title"]')
        title = titleValue.get_attribute("innerText")
    except:
        titleValue = "Product not found"
        pass
    
    fields = {
        "Title": titleValue
    }

    print(f"Product {idx}: {fields}")
    
    return fields
2 Likes

You’re ok, it might be a little bit but I will try to see what I can do. I have a class starting soon but I should be able to help you in a few.

Sorry, I’m unable to help with this, but maybe @not-ethan or @anon45021817, or @InvisibleOne could help you. Sorry, once again but I hope you enjoy your time with us! :wave:

Did u find solution I have also stuck on same error

1 Like

After reading closely the error, I think it’s saying that Chrome isn’t installed, as is on most repls

1 Like

I have the same problem, would appreciate some help

1 Like

Also having the same problem related to Chrome not being installed. Can anyone help?

My error says this:

Traceback (most recent call last):
  File "main.py", line 81, in <module>
    run_selenium()
  File "main.py", line 20, in run_selenium
    u_driver = uc.Chrome(use_subprocess=True)
  File "/home/runner/Coupon-Bot/venv/lib/python3.10/site-packages/undetected_chromedriver/__init__.py", line 361, in __init__
    options.binary_location = (
  File "/home/runner/Coupon-Bot/venv/lib/python3.10/site-packages/selenium/webdriver/chromium/options.py", line 55, in binary_location
    raise TypeError(self.BINARY_LOCATION_ERROR)
TypeError: Binary Location Must be a String
import csv
import os
import sys

from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium import webdriver
import undetected_chromedriver as uc
import time
import random

def run_selenium():
    
    # Create a new Chrome browser driver
    u_driver = uc.Chrome(use_subprocess=True)

    # Open the Google search results page for "dentists near me"
    u_driver.get("https://www.wethrift.com/")

    u_driver.maximize_window()

    time.sleep(10)