# TLDR Brave browser'ı python'da yazılmış selenyum ile kullanmak istiyorum ancak işe yarayan herhangi bir güncel çözüm bulamıyorum.
Bu kod çalışır
from selenium import webdriver
option = webdriver.ChromeOptions()
option.binary_location = r'C:\Program Files\BraveSoftware\Brave-
Browser\Application\brave.exe'
driver = webdriver.Chrome(executable_path=r'C:\WebDrivers\chromedriver.exe',
options=option)
driver.get("https://www.google.com")
driver.quit()
ancak executable_path kullanımdan kaldırıldı:
C:\Users\USER\PycharmProjects\pythonProject\sol2.py:5:
DeprecationWarning: executable_path has been deprecated, please pass in a Service object
driver = webdriver.Chrome(executable_path=r'C:\WebDrivers\chromedriver.exe', options=option)
Bunu youtube'da buldum: https://www.youtube.com/watch?v=VMzmVFA-Gps
# import statements
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
# Declare variables and setup services
driverService = Service('C:/webdrivers/chromedriver.exe')
# 1. Passes the chromedriver path to the service object
# 2. stores the service object in the s variable
driver = webdriver.Chrome(service=driverService)
# 1. Passes service object s into the webdriver.Chrome
# 2. Stores object in driver variable
# Body (actually doing stuff)
driver.maximize_window() # maximizes the browser window
driver.get("https://www.google.com") # navigates to google.com
myPageTitle = driver.title
# gets the title of the web page stores in myPageTitle
print(myPageTitle) # prints myPageTitle to Console
assert "Google" in myPageTitle
# checks myPageTitle to ensure it contains Google
# clean up
driver.quit() # closes the browser
Bu kodu çalıştırdığımda alıyorum: selenyum.ortak.istisna.WebDriverException: İleti: bilinmiyor hata: Chrome ikili dosyası bulunamıyor
Bu kod, Google Chrome'un bilgisayarınıza girmesine izin verdiğiniz sürece çalışır. Bilgisayarımda Chrome'u istemiyorum.
Sorun şu ki, selenyumun Chrome yerine brave kullanmasını nasıl sağlayacağımı anlayamıyorum.
Bu yazı itibariyle aşağıdakileri kullanıyorum:
Windows 11 Ana Sayfa
Selenyum v4.0.0
Python v3. 10
ChromeDriver 95.0.4638.69
Cesur Tarayıcı Sürüm 1.31.91 Krom: 95.0.4638.69 (Resmi Yapı) (64-bit)
Birisi lütfen bunun brave browser'daki geçerli (okunmamış) kodla nasıl çalışacağını açıklayabilir mi? Zaman ayırdığınız için teşekkürler.