TypeError: __init__() got an unexpected keyword argument ‘executable_path’

2024年6月18日

以下の修正で試してみてください。

python
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
from selenium.webdriver.chrome.options import Options as ChromeOptions
from webdriver_manager.chrome import ChromeDriverManager

# ChromeOptionsオブジェクトを作成
chrome_options = ChromeOptions()
chrome_options.binary_location = "/usr/bin/google-chrome-stable"  # お使いの環境に合わせて変更してください

# ChromeDriverのパスを取得
chrome_driver_path = ChromeDriverManager().install()

# ChromeDriverを起動
driver = webdriver.Chrome(options=chrome_options)

この修正でエラーが解消するか確認してみてください。 executable_pathを使用する必要がない場合は、引数から取り除きました。

未分類

Posted by ぼっち