AWS cloud9(python) でのchromedriverとseleniumのエラー解決方法を教えてください。
解決したいこと
aws cloud9(python) でのプログラムを実行するとchromedriverとseleniumのバージョンが違うせいかエラーが出て解決できません。どうか解決方法をご教示ください。(当方初心者ですのでわかりやすくお願い致します)
selenium4.13.0です。
発生している問題・エラー
出ているエラーメッセージを入力
The chromedriver version (120.0.6099.71) detected in PATH at /usr/local/bin/chromedriver might not be compatible with the detected chrome version (121.0.6167.85); currently, chromedriver 121.0.6167.85 is recommended for chrome 121.*, so it is advised to delete the driver in PATH and retry
Traceback (most recent call last):
File "atr.py", line 29, in
main()
File "atr.py", line 12, in main
schedule.run_pending()
File "/usr/local/lib/python3.8/site-packages/schedule/init.py", line 822, in run_pending
default_scheduler.run_pending()
File "/usr/local/lib/python3.8/site-packages/schedule/init.py", line 100, in run_pending
self._run_job(job)
File "/usr/local/lib/python3.8/site-packages/schedule/init.py", line 172, in _run_job
ret = job.run()
File "/usr/local/lib/python3.8/site-packages/schedule/init.py", line 693, in run
ret = self.job_func()
File "atr.py", line 21, in process_every_minute
sec = sb.Sb()
File "/home/ec2-user/environment/auto/sbi.py", line 59, in init
self.driver = webdriver.Chrome(options=options)
File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in init
super().init(
File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/chromium/webdriver.py", line 56, in init
super().init(
File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 205, in init
self.start_session(capabilities)
File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 289, in start_session
response = self.execute(Command.NEW_SESSION, caps)["value"]
File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 344, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome failed to start: exited normally.
(session not created: DevToolsActivePort file doesn't exist)
(The process started from chrome location /home/ec2-user/.cache/selenium/chrome/linux64/121.0.6167.85/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
#0 0x55b5acbb0d33
#1 0x55b5ac86df87
#2 0x55b5ac8a587e
#3 0x55b5ac8a24de
#4 0x55b5ac8f2a90
#5 0x55b5ac8e70e3
#6 0x55b5ac8af044
#7 0x55b5ac8b044e
#8 0x55b5acb75861
#9 0x55b5acb79785
#10 0x55b5acb63285
#11 0x55b5acb7a41f
#12 0x55b5acb4720f
#13 0x55b5acb9e028
#14 0x55b5acb9e1f7
#15 0x55b5acbafed4
#16 0x7f9f3c29a44b start_thread
該当するソースコード
秘密保持契約があるため記載できません(申し訳ありません)
自分で試したこと
wget https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/120.0.6099.71/linux64/chromedriver-linux64.zip
unzip chromedriver-linux64.zip
sudo mv chromedriver-linux64 /usr/local/bin/
chmod 755 /usr/local/bin/chromedriver-linux64