こんにちは
現在WSL2内のDockerコンテナから,seleniumを用いたスクレイピングを行いたいのですが
オプションを追記してもchrome not reachableと出て,失敗します
調べたところHitしたオプションは追記してみたのですが,エラーの原因など特定できないでしょうか?
python
1from bs4 import BeautifulSoup 2from selenium import webdriver 3import chromedriver_binary 4 5url = "https://www.google.co.jp/" 6 7 8chrome_options= webdriver.ChromeOptions() 9chrome_options.add_argument('--headless') 10# chrome_options.add_argument('--disable-gpu') 11chrome_options.add_argument('–no-sandbox') 12# chrome_options.add_argument("--disable-dev-shm-usage"); 13chrome_options.add_argument("--remote-debugging-port=9222") 14driver = webdriver.Chrome(options=chrome_options) 15 16driver.get(url) 17html = driver.page_source.encode('utf-8') 18soup = BeautifulSoup(html, 'lxml')
File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in init
super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/chromium/webdriver.py", line 93, in init
RemoteWebDriver.init(
File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 266, in init
self.start_session(capabilities, browser_profile)
File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 357, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 418, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 243, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally.
(chrome not reachable)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
#0 0x55932d39cee3 <unknown>
#1 0x55932ce6a608 <unknown>
#2 0x55932ce8d8ef <unknown>
#3 0x55932ce8946f <unknown>
#4 0x55932cec3f45 <unknown>
#5 0x55932cebe163 <unknown>
#6 0x55932ce93bfc <unknown>
#7 0x55932ce94c05 <unknown>
#8 0x55932d3cebaa <unknown>
#9 0x55932d3e4651 <unknown>
#10 0x55932d3cfb05 <unknown>
#11 0x55932d3e5a68 <unknown>
#12 0x55932d3c405f <unknown>
#13 0x55932d400818 <unknown>
#14 0x55932d400998 <unknown>
#15 0x55932d41beed <unknown>
#16 0x7f22fa5faea7 <unknown>
あなたの回答
tips
プレビュー