我是一個初級的python程式員,
我目前正在使用 selenium 開發瀏覽器自動化,但目前我使用的是勇敢的 96.0.4664.45 版本,我的 chrome 驅動程式無法正常作業,而 geckodriver 與 firfox 一起作業正常
此處出錯---> python 路徑中硒庫的錯誤,我這邊全部正確
請盡快幫助我
uj5u.com熱心網友回復:
我建議嘗試 webdriver_manager
https://github.com/SergeyPirogov/webdriver_manager。
它有助于設定 chromedriver 的路徑。
對于鉻:
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())
對于鉻:
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.utils import ChromeType
driver = webdriver.Chrome(ChromeDriverManager(chrome_type=ChromeType.CHROMIUM).install())
我想其中一些對 Brave 有用。
另外,看看這個例子:
https://gist.github.com/passivebot/91d726bafc1f08eb475dd8384a3f21db
uj5u.com熱心網友回復:
發起一個 勇敢的 您需要的瀏覽背景關系:
- 使用
binary_location屬性指向勇敢的二進制位置。 - 使用chromedriver可執行檔案來啟動勇敢的瀏覽器。
代碼塊:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
option = webdriver.ChromeOptions()
option.binary_location = r'C:\Program Files (x86)\BraveSoftware\Brave-Browser\Application\brave.exe'
driverService = Service('C:/Users/.../chromedriver.exe')
driver = webdriver.Chrome(service=driverService, options=option)
driver.get("https://www.google.com")
參考
您可以在以下位置找到一些相關的詳細討論:
- 如何使用帶有 python、selenium 和 chromedriver 的 Brave 網路瀏覽器?
- 將 Selenium 與用 Python 撰寫的 Brave Browser 傳遞服務物件一起使用
- 如何在 Windows 上使用 Selenium 和 Python 啟動 Brave 瀏覽器
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/391976.html
