このページの翻訳:
- 日本語 (ja)
- English (en)
最近の更新
Tag Cloud
このページへのアクセス
今日: 4 / 昨日: 13
総計: 641
- DokuWiki(124)
- Dokuwiki.fl8.jp(113)
- サカつく初代(17)
- Gallery(14)
- 01_サカつく初代 05年目(14)
- 01_サカつく初代 01年目(14)
- FreeBSD カーネル再構築(13)
最近の更新
このページへのアクセス
今日: 4 / 昨日: 13
総計: 641
PythonでChrome Driverを読み込む時にエラーになる。
from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.chrome.options import Options from selenium.webdriver.chrome.service import Service options = Options() driver_path = ChromeDriverManager().install() print(f"ChromeDriver is installed at: {driver_path}") global_service = Service(driver_path) driver = webdriver.Chrome(service=global_service, options=options)
OSError: [WinError 193] %1 は有効な Win32 アプリケーションではありません。
driverのパスをprintfしてみると、THIRD_PARTY_NOTICES.chromedriverになってる。
C:\Users\s-matsui\.wdm\drivers\chromedriver\win64\132.0.6834.160\chromedriver-win32/THIRD_PARTY_NOTICES.chromedriver
そこで、Pathを修正するして、chromedriver.exeに変えてあげると動作しました。
from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.chrome.options import Options from selenium.webdriver.chrome.service import Service options = Options() driver_path = ChromeDriverManager().install() ## Pathを修正 driver_path = driver_path.replace("THIRD_PARTY_NOTICES.chromedriver", "chromedriver.exe") print(f"ChromeDriver is installed at: {driver_path}") global_service = Service(driver_path) driver = webdriver.Chrome(service=global_service, options=options)