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
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
1 Like

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 @Doomsdaybear, or @InvisibleOne could help you. Sorry, once again but I hope you enjoy your time with us! :wave: