前提・実現したいこと
chromeを使ったスクレイピングを行いたいです。
そこで、chromedriverを使おうとしましたが、下記エラーが表示され実行できずにいます。
解決策をご存じの方居られましたらご教示ください。
■「cannot find Chrome binary」
Chromeの実行ファイルを見つけることができていないと考えています。
発生している問題・エラーメッセージ
WebDriverException Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_15072/1528954596.py in <module>
----> 1 chrome = webdriver.Chrome(ChromeDriverManager().install())
2 driver.get('https://google.com' class="ansi-yellow-intense-fg ansi-bold">)
C:\JupyterLab\resources\jlab_server\lib\site-packages\selenium\webdriver\chrome\webdriver.py in init(self, executable_path, port, options, service_args, desired_capabilities, service_log_path, chrome_options, keep_alive)
74
75 try:
---> 76 RemoteWebDriver.init(
77 self,
78 command_executor=ChromeRemoteConnection(
C:\JupyterLab\resources\jlab_server\lib\site-packages\selenium\webdriver\remote\webdriver.py in init(self, command_executor, desired_capabilities, browser_profile, proxy, keep_alive, file_detector, options)
155 warnings.warn("Please use FirefoxOptions to set browser profile",
156 DeprecationWarning, stacklevel=2)
--> 157 self.start_session(capabilities, browser_profile)
158 self._switch_to = SwitchTo(self)
159 self._mobile = Mobile(self)
C:\JupyterLab\resources\jlab_server\lib\site-packages\selenium\webdriver\remote\webdriver.py in start_session(self, capabilities, browser_profile)
250 parameters = {"capabilities": w3c_caps,
251 "desiredCapabilities": capabilities}
--> 252 response = self.execute(Command.NEW_SESSION, parameters)
253 if 'sessionId' not in response:
254 response = response['value']
C:\JupyterLab\resources\jlab_server\lib\site-packages\selenium\webdriver\remote\webdriver.py in execute(self, driver_command, params)
319 response = self.command_executor.execute(driver_command, params)
320 if response:
--> 321 self.error_handler.check_response(response)
322 response['value'] = self._unwrap_value(
323 response.get('value', None))
C:\JupyterLab\resources\jlab_server\lib\site-packages\selenium\webdriver\remote\errorhandler.py in check_response(self, response)
240 alert_text = value['alert'].get('text')
241 raise exception_class(message, screen, stacktrace, alert_text)
--> 242 raise exception_class(message, screen, stacktrace)
243
244 def _value_or_default(self, obj, key, default):
WebDriverException: Message: unknown error: cannot find Chrome binary
1-1 from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager from selenium import webdriver from time import sleep import chromedriver_binary 1-2 chrome = webdriver.Chrome(ChromeDriverManager().install()) driver.get('https://google.com') ### 試したこと 1-2実行結果 ====== WebDriver manager ====== Current google-chrome version is 94.0.4606 Get LATEST driver version for 94.0.4606 Driver [C:\Users\nukok.wdm\drivers\chromedriver\win32\94.0.4606.61\chromedriver.exe] found in cache ### 補足情報(FW/ツールのバージョンなど) OS:windows 64bit Chrome:94.0.4606 install path:C:\Program Files\Google\Chrome\Application ChromeDriver:94.0.4606 実行環境:JupyterLab Python 3.9.5 selenium 3.141.0 ![イメージ説明](c168e5c55e53afa87fdc1e29251b666c.jpeg)
回答1件
あなたの回答
tips
プレビュー