How to use undetected chromedriver with Brave

1.4k views Asked by At

I want to access a website and use the Brave Brower which I got running. The website opens but Cloudflare hinders me from accessing the site:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service

chromedriver = r"C:/SeleniumDrivers/chromedriver.exe"
option = webdriver.ChromeOptions()
option.binary_location = "C:/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe"
s = Service(chromedriver)
driver = webdriver.Chrome(service=s, options=option)
driver.get(url)

Therefore I want to use undetected_chromedriver but I just can not get it to run. Here is what I have tried until now:

import undetected_chromedriver as uc

chromedriver = r"C:/SeleniumDrivers/chromedriver.exe"
brave = 'C:/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe'
option = uc.ChromeOptions()
option.binary_location = brave
driver = uc.Chrome(driver_executable_path=chromedriver, options=option)
driver.get(url)

This code returns a PermissionError which I can not explain at all.

PermissionError: [Errno 13] Permission denied: 'C:/SeleniumDrivers/chromedriver.exe'

Any tips or solutions that work? Maybe there is a way that lets me access the website and bypasses Cloudlfare with selenium as that Code is running.

1

There are 1 answers

5
fier On

have you tried running the process as an administrator?